當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript prosemirror-state.EditorState類代碼示例

本文整理匯總了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;未經允許,請勿轉載。