本文整理汇总了TypeScript中prosemirror-state.EditorState类的典型用法代码示例。如果您正苦于以下问题:TypeScript EditorState类的具体用法?TypeScript EditorState怎么用?TypeScript EditorState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EditorState类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: createState
export function createState(schema: Schema, nodeOrJson: Node | any, plugins?: Plugin[]) {
return EditorState.create({
schema,
doc: nodeOrJson instanceof Node ? nodeOrJson : Node.fromJSON(schema, nodeOrJson.doc),
plugins,
})
}
开发者ID:zodiac-team,项目名称:zodiac-ui,代码行数:7,代码来源:create-state.ts
示例2: save
public save(state: EditorState) {
try {
localStorage.setItem("basic-editor-state", JSON.stringify(state.toJSON()))
} catch (e) {
console.error("Document too large to save or contains errors")
console.error(e)
}
}
开发者ID:zodiac-team,项目名称:zodiac-ui,代码行数:8,代码来源:basic-editor.component.ts
示例3: update
update(content: string, images?: ProseMirrorImage[]) {
if (content !== this.content || images) {
this.content = content;
this.images = images || this.images;
let state = EditorState.create(this.stateConfig());
this.view.update(this.viewProps(state));
}
}
开发者ID:PRX,项目名称:publish.prx.org,代码行数:8,代码来源:prosemirror.markdown.editor.ts
示例4: constructor
constructor(private el: ElementRef,
private content: string,
private inputFormat: string,
private outputFormat: string,
private editable: boolean,
private images: ProseMirrorImage[],
private setModel: Function,
private promptForLink: Function) {
this.outputSchema = this.outputFormat === ProseMirrorFormatTypes.HTML ? basicSchema : markdownSchema;
let state = EditorState.create(this.stateConfig());
this.view = new MenuBarEditorView(el.nativeElement, this.viewProps(state));
if (this.inputFormat === ProseMirrorFormatTypes.MARKDOWN && this.outputFormat === ProseMirrorFormatTypes.HTML) {
this.plainTextWithLinks();
this.content = this.removeHTML(this.view.editor.docView.dom.innerHTML);
} else if (this.inputFormat === this.outputFormat) {
if (this.outputFormat === ProseMirrorFormatTypes.MARKDOWN) {
this.content = defaultMarkdownSerializer.serialize(this.view.editor.state.doc);
} else {
this.content = this.removeHTML(this.view.editor.docView.dom.innerHTML);
}
}
}
开发者ID:PRX,项目名称:publish.prx.org,代码行数:22,代码来源:prosemirror.markdown.editor.ts
示例5: createState
function createState(d: pm.TaggedProsemirrorNode) {
return EditorState.create({ doc: d, selection: selectionFor(d) });
}
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:3,代码来源:prosemirror-test-builder-tests.ts
注:本文中的prosemirror-state.EditorState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论