当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ContentState.createFromText方法代码示例

本文整理汇总了TypeScript中draft-js.ContentState.createFromText方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ContentState.createFromText方法的具体用法?TypeScript ContentState.createFromText怎么用?TypeScript ContentState.createFromText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在draft-js.ContentState的用法示例。


在下文中一共展示了ContentState.createFromText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: setTextToEditor

 setTextToEditor(text: string) {
     return EditorState.moveSelectionToEnd(
         EditorState.push(
             this.core,
             ContentState.createFromText(text),
             'insert-characters'
         )
     );
 }
开发者ID:DevenLu,项目名称:YourFukurou,代码行数:9,代码来源:tweet_editor.ts

示例2: closeEditor

 closeEditor() {
     GlobalKeyMaps.enable();
     return new TweetEditorState(
         EditorState.push(
             this.core,
             ContentState.createFromText(''),
             'remove-range'
         ),
         false,
         this.keymaps,
         null
     );
 }
开发者ID:DevenLu,项目名称:YourFukurou,代码行数:13,代码来源:tweet_editor.ts

示例3: handlePastedText

export function handlePastedText(text: string, _html: string): DraftHandleValue {
    const author = getCurrentAuthor();
    let html = _html;

    if (typeof html === 'string') {
        html = removeMediaFromHtml(html);
    }

    const {editorState, suggestingMode, onPasteFromSuggestingMode, onChange, editorFormat} = this.props;

    if (!html && !text) {
        return 'handled';
    }

    if (suggestingMode) {
        if (!Suggestions.allowEditSuggestionOnLeft(editorState, author)
            && !Suggestions.allowEditSuggestionOnRight(editorState, author)) {
            return 'handled';
        }

        const content = html ? getContentStateFromHtml(html) : ContentState.createFromText(text);

        onPasteFromSuggestingMode(content);
        return 'handled';
    }

    if (html &&
        pasteContentFromOpenEditor(html, editorState, onChange, editorFormat) === 'handled') {
        return 'handled';
    }

    if (htmlComesFromDraftjsEditor(html)) {
        return 'not-handled';
    }

    return processPastedHtml(html || text, editorState, onChange, editorFormat);
}
开发者ID:jerome-poisson,项目名称:superdesk-client-core,代码行数:37,代码来源:handlePastedText.ts

示例4:

    y: 0.25,
    r: 0,
    z: 0,
    width: 1,
    height: 1,
    fill: "#609eeb",
    stroke: "#4e8bda",
    strokeWidth: 1,
    strokeOpacity: 1.0,
    fillOpacity: 1.0,
  },
  Text: {
    id: "0",
    type: PubShapeType.Text,
    x: 0.25,
    y: 0.25,
    r: 0,
    z: 0,
    editorState: EditorState.createWithContent(
      ContentState.createFromText("Double click to insert text")
    ),
    fill: "",
    fillOpacity: 1,
    stroke: "",
    strokeOpacity: 0,
    strokeWidth: 0,
    width: 2,
    height: 1,
  },
};
开发者ID:carlospaelinck,项目名称:publications-js,代码行数:30,代码来源:new-shapes.ts


注:本文中的draft-js.ContentState.createFromText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。