aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/DocumentView.tsx3
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 7b9ed12a7..44e9b3180 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -438,7 +438,6 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
@undoBatch
makeNativeViewClicked = (): void => {
- (this.dataDoc || Doc.GetProto(this.props.Document)).customLayout = this.props.Document.layout;
this.props.Document.layout = this.props.Document.nativeLayout;
this.props.Document.type = this.props.Document.nativeType;
this.props.Document.nativeWidth = this.props.Document.nativeNativeWidth;
@@ -473,6 +472,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
Doc.MakeTemplate(fieldTemplate, metaKey, proto);
Doc.ApplyTemplateTo(docTemplate, this.props.Document, undefined, false);
+ Doc.GetProto(this.dataDoc || this.props.Document).customLayout = this.props.Document.layout;
}
});
}
@@ -690,6 +690,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
}
});
+ cm.addItem({ description: "Publish", event: () => DocUtils.Publish(this.props.Document, StrCast(this.props.Document.title), this.props.addDocument, this.props.removeDocument), icon: "file" });
cm.addItem({ description: "Delete", event: this.deleteClicked, icon: "trash" });
type User = { email: string, userDocumentId: string };
let usersMenu: ContextMenuProps[] = [];
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index c07461e13..04d24fe8c 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -293,7 +293,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
}
recordKeyHandler = (e: KeyboardEvent) => {
- if (this.props.Document === SelectionManager.SelectedDocuments()[0].props.Document) {
+ if (SelectionManager.SelectedDocuments().length && this.props.Document === SelectionManager.SelectedDocuments()[0].props.Document) {
if (e.key === "R" && e.altKey) {
e.stopPropagation();
e.preventDefault();
@@ -473,7 +473,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
this._fontFamily = rules.font;
this._fontSize = rules.size;
setTimeout(() => {
- if (this._editorView!.state.doc.childCount) {
+ if (this._editorView!.state.doc.childCount && this._proseRef) {
let tr = this._editorView!.state.tr;
let n = new NodeSelection(this._editorView!.state.doc.resolve(0));
if (this._editorView!.state.doc.textContent === "") {