diff options
Diffstat (limited to 'src/client/views/nodes/formattedText')
| -rw-r--r-- | src/client/views/nodes/formattedText/FormattedTextBox.tsx | 9 | ||||
| -rw-r--r-- | src/client/views/nodes/formattedText/RichTextMenu.tsx | 5 | 
2 files changed, 7 insertions, 7 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 16aa4de6c..7afa54d5f 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -279,8 +279,6 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp                      (curText !== Cast(this.dataDoc[this.fieldKey], RichTextField)?.Text) && (this.dataDoc[this.props.fieldKey + "-lastModified"] = new DateField(new Date(Date.now())));                      if ((!curTemp && !curProto) || curText || json.includes("dash")) { // if no template, or there's text that didn't come from the layout template, write it to the document. (if this is driven by a template, then this overwrites the template text which is intended)                          if (removeSelection(json) !== removeSelection(curLayout?.Data)) { -                            !curText && tx.storedMarks?.filter(m => m.type.name === "pFontSize").map(m => Doc.UserDoc().fontSize = this.layoutDoc._fontSize = (m.attrs.fontSize + "px")); -                            !curText && tx.storedMarks?.filter(m => m.type.name === "pFontFamily").map(m => Doc.UserDoc().fontFamily = this.layoutDoc._fontFamily = m.attrs.fontFamily);                              this.dataDoc[this.props.fieldKey] = new RichTextField(json, curText);                              this.dataDoc[this.props.fieldKey + "-noTemplate"] = true;//(curTemp?.Text || "") !== curText; // mark the data field as being split from the template if it has been edited                              ScriptCast(this.layoutDoc.onTextChanged, null)?.script.run({ this: this.layoutDoc, self: this.rootDoc, text: curText }); @@ -894,11 +892,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp              { fireImmediately: Doc.IsSearchMatchUnmemoized(this.rootDoc) ? true : false });          this._disposers.selected = reaction(() => this.props.isSelected(), -            action((selected) => { +            action(selected => {                  if (RichTextMenu.Instance?.view === this._editorView && !selected) {                      RichTextMenu.Instance?.updateMenu(undefined, undefined, undefined);                  } -            })); +                if (this._editorView && selected) { +                    RichTextMenu.Instance?.updateMenu(this._editorView, undefined, this.props); +                } +            }), { fireImmediately: true });          if (!this.props.dontRegisterView) {              this._disposers.record = reaction(() => this._recording, diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx index 3efc46259..bd05af977 100644 --- a/src/client/views/nodes/formattedText/RichTextMenu.tsx +++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx @@ -188,11 +188,10 @@ export class RichTextMenu extends AntimodeMenu<AntimodeMenuProps>   {          if (this.TextView.props.isSelected(true)) {              const state = this.view.state;              const pos = this.view.state.selection.$from; -            const marks: Mark<any>[] = []; +            const marks: Mark<any>[] = [...(state.storedMarks ?? [])];              if (state.selection.empty) {                  const ref_node = this.reference_node(pos); -                marks.push(...[...(ref_node !== this.view.state.doc && ref_node?.isText ? -                    [...(state.storedMarks ?? []), ...Array.from(ref_node.marks)] : [])]); +                marks.push(...(ref_node !== this.view.state.doc && ref_node?.isText ? Array.from(ref_node.marks) : []));              } else {                  state.doc.nodesBetween(state.selection.from, state.selection.to, (node, pos, parent, index) => {                      node.marks?.filter(mark => !mark.isInSet(marks)).map(mark => marks.push(mark));  | 
