Пример #1
0
EditorState.createFromJSON = function(schema, json) {
    return EditorState.createForNode(Node.fromJSON(schema, json));
};
Пример #2
0
var Immutable = require('immutable');
var normalizeNewline = require('normalize-newline');
var schema = require('prosemirror/dist/schema-basic').schema;
var Node = require('prosemirror/dist/model/node').Node;

var ID = 0;

var EditorState = Immutable.Record({
    id:         0,

    doc:        Node.fromJSON(schema, { type: 'doc', content: [] }),

    // Current selection (editor.selection)
    selection:  null,

    // Active marks (but not marks at current position)
    activeMarks: Immutable.List(),

    // Current history of editor (editor.history)
    history:    null,

    // First version when editor is set
    baseVersion: null,

    // List of transformation to apply in next redering
    transforms:  Immutable.List()
}, 'EditorState');

EditorState.prototype.getID = function() {
    return this.get('id');
};