Remove targeted editing from text (#1962)
This PR has been tested on Mac Chrome, iOS Safari, and Android Chrome. --- This PR removes 'targeted editing' from text. This affects when you're: * using the text tool * editing a text shape * editing a text label * editing an arrow label When in one of these modes, you were able to click on some other text to immediately start editing it (as long as that text is the same type). It was a bit broken with some of the newer changes, so this PR removes it. The issues included: * selected text 'flashing' * caret going to the start of the text * empty text shapes not disappearing * inconsistent behaviour when clicking near a shape VS on a shape It feels a bit simpler now too, I like it... 🤔💭  ### Change Type - [x] `patch` — Bug fix ### Test Plan - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Fixed some cases where text would get selected in the wrong place. - Changed the behaviour of text selection. Removed 'deep editing'. --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
parent
5668209b01
commit
b149fe7e98
6 changed files with 58 additions and 95 deletions
|
@ -25,9 +25,13 @@ export const ArrowTextLabel = React.memo(function ArrowTextLabel({
|
|||
handleChange,
|
||||
isEmpty,
|
||||
handleInputPointerDown,
|
||||
handleDoubleClick,
|
||||
} = useEditableText(id, 'arrow', text)
|
||||
|
||||
if (!isEditing && isEmpty) {
|
||||
const finalText = TextHelpers.normalizeTextForDom(text)
|
||||
const hasText = finalText.trim().length > 0
|
||||
|
||||
if (!isEditing && !hasText) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -74,6 +78,7 @@ export const ArrowTextLabel = React.memo(function ArrowTextLabel({
|
|||
onBlur={handleBlur}
|
||||
onContextMenu={stopEventPropagation}
|
||||
onPointerDown={handleInputPointerDown}
|
||||
onDoubleClick={handleDoubleClick}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue