diff options
-rw-r--r-- | src/client/views/DocumentDecorations.tsx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 2dc496bc1..a72f02f14 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -14,7 +14,7 @@ import './DocumentDecorations.scss'; import { DocumentView } from "./nodes/DocumentView"; import { LinkMenu } from "./nodes/LinkMenu"; import React = require("react"); -import { FieldWaiting } from "../../fields/Field"; +import { FieldWaiting, Field } from "../../fields/Field"; import { emptyFunction } from "../../Utils"; import { Main } from "./Main"; import { undo } from "prosemirror-history"; @@ -74,7 +74,20 @@ export class DocumentDecorations extends React.Component<{}, { value: string }> // TODO: Change field with switch statement } else { - this._title = "changed"; + if (this._documents.length > 0) { + let field = this._documents[0].props.Document.Get(this._fieldKey); + if (field instanceof TextField) { + this._documents.forEach(d => { + d.props.Document.Set(this._fieldKey, new TextField(this._title)); + }); + } + else if (field instanceof NumberField) { + this._documents.forEach(d => { + d.props.Document.Set(this._fieldKey, new NumberField(+this._title)) + }); + } + this._title = "changed"; + } } e.target.blur(); } |