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


TypeScript Editor.load方法代码示例

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


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

示例1: function

const initContentBody = function (editor: Editor, skipWrite?: boolean) {
  const settings = editor.settings;
  const targetElm = editor.getElement();
  let doc = editor.getDoc(), body, contentCssText;

  // Restore visibility on target element
  if (!settings.inline) {
    editor.getElement().style.visibility = editor.orgVisibility;
  }

  // Setup iframe body
  if (!skipWrite && !settings.content_editable) {
    doc.open();
    doc.write(editor.iframeHTML);
    doc.close();
  }

  if (settings.content_editable) {
    editor.on('remove', function () {
      const bodyEl = this.getBody();

      DOM.removeClass(bodyEl, 'mce-content-body');
      DOM.removeClass(bodyEl, 'mce-edit-focus');
      DOM.setAttrib(bodyEl, 'contentEditable', null);
    });

    DOM.addClass(targetElm, 'mce-content-body');
    editor.contentDocument = doc = settings.content_document || document;
    editor.contentWindow = settings.content_window || window;
    editor.bodyElement = targetElm;

    // Prevent leak in IE
    settings.content_document = settings.content_window = null;

    // TODO: Fix this
    settings.root_name = targetElm.nodeName.toLowerCase();
  }

  // It will not steal focus while setting contentEditable
  body = editor.getBody();
  body.disabled = true;
  editor.readonly = settings.readonly;

  if (!editor.readonly) {
    if (editor.inline && DOM.getStyle(body, 'position', true) === 'static') {
      body.style.position = 'relative';
    }

    body.contentEditable = editor.getParam('content_editable_state', true);
  }

  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) {
//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:InitContentBody.ts


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