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


TypeScript Editor.getContent方法代码示例

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


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

示例1: Date

const storeDraft = (editor: Editor) => {
  const prefix = Settings.getAutoSavePrefix(editor);

  if (!isEmpty(editor) && editor.isDirty()) {
    LocalStorage.setItem(prefix + 'draft', editor.getContent({ format: 'raw', no_events: true }) as string);
    LocalStorage.setItem(prefix + 'time', new Date().getTime().toString());
    Events.fireStoreDraft(editor);
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:Storage.ts

示例2: function


//.........这里部分代码省略.........
    // Override commands to use the text formatter engine
    'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' (command) {
      toggleFormat(command);
    },

    // Override commands to use the text formatter engine
    'ForeColor,HiliteColor' (command, ui, value) {
      toggleFormat(command, value);
    },

    'FontName' (command, ui, value) {
      FontCommands.fontNameAction(editor, value);
    },

    'FontSize' (command, ui, value) {
      FontCommands.fontSizeAction(editor, value);
    },

    'RemoveFormat' (command) {
      formatter.remove(command);
    },

    'mceBlockQuote' () {
      toggleFormat('blockquote');
    },

    'FormatBlock' (command, ui, value) {
      return toggleFormat(value || 'p');
    },

    'mceCleanup' () {
      const bookmark = selection.getBookmark();

      editor.setContent(editor.getContent());
      selection.moveToBookmark(bookmark);
    },

    'mceRemoveNode' (command, ui, value) {
      const node = value || selection.getNode();

      // Make sure that the body node isn't removed
      if (node !== editor.getBody()) {
        storeSelection();
        editor.dom.remove(node, true);
        restoreSelection();
      }
    },

    'mceSelectNodeDepth' (command, ui, value) {
      let counter = 0;

      dom.getParent(selection.getNode(), function (node) {
        if (node.nodeType === 1 && counter++ === value) {
          selection.select(node);
          return false;
        }
      }, editor.getBody());
    },

    'mceSelectNode' (command, ui, value) {
      selection.select(value);
    },

    'mceInsertContent' (command, ui, value) {
      InsertContent.insertAtCaret(editor, value);
    },
开发者ID:danielpunkass,项目名称:tinymce,代码行数:67,代码来源:EditorCommands.ts

示例3: function


//.........这里部分代码省略.........

  body.disabled = false;

  editor.editorUpload = EditorUpload(editor);
  editor.schema = Schema(settings);
  editor.dom = DOMUtils(doc, {
    keep_values: true,
    url_converter: editor.convertURL,
    url_converter_scope: editor,
    hex_colors: settings.force_hex_style_colors,
    class_filter: settings.class_filter,
    update_styles: true,
    root_element: editor.inline ? editor.getBody() : null,
    collect: settings.content_editable,
    schema: editor.schema,
    contentCssCors: Settings.shouldUseContentCssCors(editor),
    onSetAttrib (e) {
      editor.fire('SetAttrib', e);
    }
  });

  editor.parser = createParser(editor);
  editor.serializer = Serializer(settings, editor);
  editor.selection = Selection(editor.dom, editor.getWin(), editor.serializer, editor);
  editor.annotator = Annotator(editor);
  editor.formatter = Formatter(editor);
  editor.undoManager = UndoManager(editor);
  editor._nodeChangeDispatcher = new NodeChange(editor);
  editor._selectionOverrides = SelectionOverrides(editor);

  DetailsElement.setup(editor);
  MultiClickSelection.setup(editor);
  KeyboardOverrides.setup(editor);
  ForceBlocks.setup(editor);

  editor.fire('PreInit');

  if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {
    doc.body.spellcheck = false; // Gecko
    DOM.setAttrib(body, 'spellcheck', 'false');
  }

  editor.quirks = Quirks(editor);
  editor.fire('PostRender');

  if (settings.directionality) {
    body.dir = settings.directionality;
  }

  if (settings.nowrap) {
    body.style.whiteSpace = 'nowrap';
  }

  if (settings.protect) {
    editor.on('BeforeSetContent', function (e) {
      Tools.each(settings.protect, function (pattern) {
        e.content = e.content.replace(pattern, function (str) {
          return '<!--mce:protected ' + escape(str) + '-->';
        });
      });
    });
  }

  editor.on('SetContent', function () {
    editor.addVisual(editor.getBody());
  });

  editor.load({ initial: true, format: 'html' });
  editor.startContent = editor.getContent({ format: 'raw' }) as string;

  editor.on('compositionstart compositionend', function (e) {
    editor.composing = e.type === 'compositionstart';
  });

  // Add editor specific CSS styles
  if (editor.contentStyles.length > 0) {
    contentCssText = '';

    Tools.each(editor.contentStyles, function (style) {
      contentCssText += style + '\r\n';
    });

    editor.dom.addStyle(contentCssText);
  }

  getStyleSheetLoader(editor).loadAll(
    editor.contentCSS,
    function (_) {
      initEditor(editor);
    },
    function (urls) {
      initEditor(editor);
    }
  );

  // Append specified content CSS last
  if (settings.content_style) {
    appendStyle(editor, settings.content_style);
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:InitContentBody.ts

示例4:

 Chain.mapper(() => ed.getContent()),
开发者ID:danielpunkass,项目名称:tinymce,代码行数:1,代码来源:AnnotationPersistenceTest.ts


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