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


TypeScript Editor.execCommand函数代码示例

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


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

示例1: function

const applyColour = function (editor: Editor, format, value, onChoice: (v: string) => void) {
  if (value === 'custom') {
    const dialog = colorPickerDialog(editor);
    dialog((colorOpt) => {
      colorOpt.each((color) => {
        Settings.addColor(color);
        editor.execCommand('mceApplyTextcolor', format, color);
        onChoice(color);
      });
    }, '#000000');
  } else if (value === 'remove') {
    onChoice('');
    editor.execCommand('mceRemoveTextcolor', format);
  } else {
    onChoice(value);
    editor.execCommand('mceApplyTextcolor', format, value);
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:18,代码来源:ColorSwatch.ts

示例2:

 optRange.each((range) => {
   editor.selection.setRng(range);
   if (pattern.type === 'inline-format') {
     pattern.format.forEach((format) => {
       editor.formatter.apply(format);
     });
   } else {
     editor.execCommand(pattern.cmd, false, pattern.value);
   }
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:PatternApplication.ts

示例3: function

    editor.on('focus', function () {
      if (!autoUrlDetectState) {
        autoUrlDetectState = true;

        try {
          editor.execCommand('AutoUrlDetect', false, true);
        } catch (ex) {
          // Ignore
        }
      }
    });
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:Keys.ts

示例4: setFocusedRange

          editor.undoManager.transact(function () {
            if (dropContent['mce-internal']) {
              editor.execCommand('Delete');
            }

            setFocusedRange(editor, rng);

            content = Utils.trimHtml(content);

            if (!dropContent['text/html']) {
              clipboard.pasteText(content);
            } else {
              clipboard.pasteHtml(content, internal);
            }
          });
开发者ID:tinymce,项目名称:tinymce,代码行数:15,代码来源:DragDrop.ts

示例5: function

const insert = function (editor: Editor, id: string) {
  const selectedNode = editor.selection.getNode();
  const isAnchor = selectedNode.tagName === 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';

  if (isAnchor) {
    selectedNode.removeAttribute('name');
    selectedNode.id = id;
    editor.undoManager.add();
  } else {
    editor.focus();
    editor.selection.collapse(true);
    editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
      id
    }));
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:16,代码来源:Anchor.ts

示例6: 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

示例7: 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

示例8: actionSketch

 const unlink = actionSketch('unlink', 'link', function () {
   editor.execCommand('unlink', null, false);
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:Features.ts

示例9:

 onAction: () => editor.execCommand('mceTogglePlainTextPaste'),
开发者ID:tinymce,项目名称:tinymce,代码行数:1,代码来源:Buttons.ts

示例10:

 onAction: () => editor.execCommand(alignNoneToolbarButton.cmd),
开发者ID:tinymce,项目名称:tinymce,代码行数:1,代码来源:AlignmentButtons.ts


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