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


TypeScript Editor.insertContent函数代码示例

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


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

示例1: function

const handleInsert = function (editor: Editor, html) {
  const beforeObjects = editor.dom.select('img[data-mce-object]');

  editor.insertContent(html);
  selectPlaceholder(editor, beforeObjects);
  editor.nodeChanged();
};
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:Dialog.ts

示例2: function

const pasteHtml = function (editor: Editor, html: string) {
  editor.insertContent(removeMeta(editor, html), {
    merge: Settings.shouldMergeFormats(editor),
    paste: true
  });

  return true;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:SmartPaste.ts

示例3: function

const insertBlob = function (editor: Editor, base64: string, blob: Blob) {
  let blobCache, blobInfo;

  blobCache = editor.editorUpload.blobCache;
  blobInfo = blobCache.create(Id.generate('mceu'), blob, base64);
  blobCache.add(blobInfo);

  editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:Actions.ts

示例4: getInsertedElement

  editor.undoManager.transact(function () {
    let tableElm, cellElm;

    editor.insertContent(createTableHtml(cols, rows));

    tableElm = getInsertedElement(editor);
    tableElm.removeAttribute('data-mce-id');
    cellElm = editor.dom.select('td,th', tableElm);
    editor.selection.setCursorLocation(cellElm[0], 0);
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:Actions.ts

示例5: applyInlinePatterns

 () => {
   // create a cursor position that we can move to avoid the inline formats
   editor.insertContent(Unicode.zeroWidth());
   applyInlinePatterns(editor, inlineAreas);
   blockArea.each((pattern) => applyBlockPattern(editor, pattern));
   // find the spot before the cursor position
   const range = editor.selection.getRng();
   const block = editor.dom.getParent(range.startContainer, editor.dom.isBlock);
   const spot = textBefore(range.startContainer, range.startOffset, block);
   editor.execCommand('mceInsertNewLine');
   // clean up the cursor position we used to preserve the format
   spot.each((s) => {
     if (s.node.data.charAt(s.offset - 1) === Unicode.zeroWidth()) {
       s.node.deleteData(s.offset - 1, 1);
       if (editor.dom.isEmpty(s.node.parentNode)) {
         editor.dom.remove(s.node.parentNode);
       }
     }
   });
 }
开发者ID:tinymce,项目名称:tinymce,代码行数:20,代码来源:KeyHandler.ts

示例6: switch

const handleMessage = (editor: Editor, api: Types.UrlDialog.UrlDialogInstanceApi, data: any) => {
  switch (data.mceAction) {
    case 'insertContent':
      editor.insertContent(data.content);
      break;
    case 'setContent':
      editor.setContent(data.content);
      break;
    case 'execCommand':
      const ui = Type.isBoolean(data.ui) ? data.ui : false;
      editor.execCommand(data.cmd, ui, data.value);
      break;
    case 'close':
      api.close();
      break;
    case 'block':
      api.block(data.message);
      break;
    case 'unblock':
      api.unblock();
      break;
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:23,代码来源:SilverUrlDialog.ts

示例7: getDefaultStyles

const insert = (editor: Editor, columns: number, rows: number): HTMLElement => {
  const defaultStyles = getDefaultStyles(editor);
  const options: TableRender.RenderOptions = {
    styles: defaultStyles,
    attributes: getDefaultAttributes(editor),
    percentages: isPercentage(defaultStyles.width) && !isPixelsForced(editor)
  };

  const table = TableRender.render(rows, columns, 0, 0, options);
  Attr.set(table, 'data-mce-id', '__mce');

  const html = Html.getOuter(table);
  editor.insertContent(html);

  return SelectorFind.descendant(Util.getBody(editor), 'table[data-mce-id="__mce"]').map((table) => {
    if (isPixelsForced(editor)) {
      Css.set(table, 'width', Css.get(table, 'width'));
    }
    Attr.remove(table, 'data-mce-id');
    fireEvents(editor, table);
    selectFirstCellInTable(editor, table);
    return table.dom();
  }).getOr(null);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:24,代码来源:InsertTable.ts

示例8: function

const insertEmoticon = function (editor: Editor, ch: string): void {
  editor.insertContent(ch);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:Actions.ts

示例9:

 onAction: (autocompleteApi, rng, value) => {
   ed.selection.setRng(rng);
   ed.insertContent('=' + value);
   autocompleteApi.hide();
 }
开发者ID:tinymce,项目名称:tinymce,代码行数:5,代码来源:AutocompleterTest.ts

示例10:

 return node.fold(() => {
   editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
   editor.selection.select(editor.$('#__new').removeAttr('id')[0]);
 }, (n) => {
开发者ID:tinymce,项目名称:tinymce,代码行数:4,代码来源:CodeSample.ts


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