@@ -106,26 +106,26 @@ export default class ElementText extends ElementRect implements IElementText {
106
106
}
107
107
108
108
get fontLineHeightFactorInputEnable ( ) : boolean {
109
- return this . status === ElementStatus . finished ;
109
+ return true ;
110
110
}
111
111
112
112
get fontLetterSpacingInputEnable ( ) : boolean {
113
113
return true ;
114
114
}
115
115
116
116
get paragraphSpacingInputEnable ( ) : boolean {
117
- return this . status === ElementStatus . finished ;
117
+ return true ;
118
118
}
119
119
120
120
get textCaseInputEnable ( ) : boolean {
121
- return this . status === ElementStatus . finished ;
121
+ return true ;
122
122
}
123
123
124
124
get textAlignInputEnable ( ) : boolean {
125
- return this . status === ElementStatus . finished ;
125
+ return true ;
126
126
}
127
127
get textVerticalAlignInputEnable ( ) : boolean {
128
- return this . status === ElementStatus . finished ;
128
+ return true ;
129
129
}
130
130
131
131
get editingEnable ( ) : boolean {
@@ -543,6 +543,8 @@ export default class ElementText extends ElementRect implements IElementText {
543
543
// 撤销
544
544
const tailUndoCommand = this . _undoRedo . tailUndoCommand ;
545
545
if ( tailUndoCommand ) {
546
+ const { relationId } = tailUndoCommand ;
547
+ if ( relationId ) await this . emitUndo ( ) ;
546
548
await this . _undoRedo . undo ( ) ;
547
549
this . _editorOperation = TextEditorOperations . UNDO ;
548
550
if ( ! [ TextEditorOperations . MOVE_CURSOR , TextEditorOperations . MOVE_SELECTION ] . includes ( tailUndoCommand . payload . operation ) ) {
@@ -553,6 +555,8 @@ export default class ElementText extends ElementRect implements IElementText {
553
555
// 回退
554
556
const tailRedoCommand = this . _undoRedo . tailRedoCommand ;
555
557
if ( tailRedoCommand ) {
558
+ const { relationId } = tailRedoCommand ;
559
+ if ( relationId ) await this . emitRedo ( ) ;
556
560
await this . _undoRedo . redo ( ) ;
557
561
this . _editorOperation = TextEditorOperations . REDO ;
558
562
if ( ! [ TextEditorOperations . MOVE_CURSOR , TextEditorOperations . MOVE_SELECTION ] . includes ( tailRedoCommand . payload . operation ) ) {
@@ -1733,6 +1737,7 @@ export default class ElementText extends ElementRect implements IElementText {
1733
1737
tailUndoCommand . payload . rData = this . _getTextEditorCommandObject ( ) ;
1734
1738
} else {
1735
1739
const command = new TextEditorUpdatedCommand (
1740
+ nanoid ( ) ,
1736
1741
{
1737
1742
type : TextEeditorCommandTypes . TextUpdated ,
1738
1743
operation : this . _editorOperation ,
@@ -1771,6 +1776,7 @@ export default class ElementText extends ElementRect implements IElementText {
1771
1776
tailUndoCommand . payload . rData = this . _getTextEditorCommandObject ( { dataExclude : true } ) ;
1772
1777
} else {
1773
1778
const command = new TextEditorUpdatedCommand (
1779
+ nanoid ( ) ,
1774
1780
{
1775
1781
type : TextEeditorCommandTypes . CursorSelectionUpdated ,
1776
1782
operation : this . _editorOperation ,
@@ -1902,4 +1908,31 @@ export default class ElementText extends ElementRect implements IElementText {
1902
1908
isModelPolygonOverlap ( coords : IPoint [ ] ) : boolean {
1903
1909
return super . isModelPolygonOverlap ( coords ) || MathUtils . isPolygonsOverlap ( this . _getTextRotateRenderCoords ( ) , coords ) ;
1904
1910
}
1911
+
1912
+ /**
1913
+ * 刷新文本编辑器撤销命令对象(刷新当前状态以便回退)
1914
+ */
1915
+ refreshUndoCommandObject ( ) : void {
1916
+ this . _undoCommandObject = this . _getTextEditorCommandObject ( ) ;
1917
+ }
1918
+
1919
+ /**
1920
+ * 关联组件撤销命令
1921
+ *
1922
+ * @param commandId
1923
+ */
1924
+ relationUndoCommand ( commandId : string ) : void {
1925
+ const editCommand = new TextEditorUpdatedCommand (
1926
+ nanoid ( ) ,
1927
+ {
1928
+ type : TextEeditorCommandTypes . CursorSelectionUpdated ,
1929
+ operation : this . _editorOperation ,
1930
+ updateId : this . _textUpdateId ,
1931
+ uData : this . _undoCommandObject ,
1932
+ } ,
1933
+ this ,
1934
+ commandId ,
1935
+ ) ;
1936
+ this . _undoRedo . add ( editCommand ) ;
1937
+ }
1905
1938
}
0 commit comments