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


TypeScript Editor.translate方法代码示例

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


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

示例1: function

 const openNotification = function () {
   return editor.notificationManager.open({
     text: editor.translate('Image uploading...'),
     type: 'info',
     timeout: -1,
     progressBar: true
   });
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:EditorUpload.ts

示例2: function

  return function (method: string, text: string, doneCallback: Function, errorCallback: Function) {
    const data = { method, lang: currentLanguageState.get() };
    let postData = '';

    data[method === 'addToDictionary' ? 'word' : 'text'] = text;

    Tools.each(data, function (value, key) {
      if (postData) {
        postData += '&';
      }

      postData += key + '=' + encodeURIComponent(value);
    });

    XHR.send({
      url: new URI(pluginUrl).toAbsolute(Settings.getRpcUrl(editor)),
      type: 'post',
      content_type: 'application/x-www-form-urlencoded',
      data: postData,
      success (result) {
        result = JSON.parse(result);

        if (!result) {
          const message = editor.translate('Server response wasn\'t proper JSON.');
          errorCallback(message);
        } else if (result.error) {
          errorCallback(result.error);
        } else {
          doneCallback(result);
        }
      },
      error () {
        const message = editor.translate('The spelling service was not found: (') +
          Settings.getRpcUrl(editor) +
          editor.translate(')');
        errorCallback(message);
      }
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:39,代码来源:Actions.ts

示例3: function

const displayNotification = function (editor: Editor, message: string) {
  editor.notificationManager.open({
    text: editor.translate(message),
    type: 'info'
  });
};
开发者ID:abstask,项目名称:tinymce,代码行数:6,代码来源:Actions.ts

示例4: function


//.........这里部分代码省略.........
  const restoreSelection = function () {
    selection.moveToBookmark(bookmark);
  };

  // Add execCommand overrides
  addCommands({
    // Ignore these, added for compatibility
    'mceResetDesignMode,mceBeginUndoLevel' () { },

    // Add undo manager logic
    'mceEndUndoLevel,mceAddUndoLevel' () {
      editor.undoManager.add();
    },

    'Cut,Copy,Paste' (command) {
      const doc = editor.getDoc();
      let failed;

      // Try executing the native command
      try {
        execNativeCommand(command);
      } catch (ex) {
        // Command failed
        failed = true;
      }

      // Chrome reports the paste command as supported however older IE:s will return false for cut/paste
      if (command === 'paste' && !doc.queryCommandEnabled(command)) {
        failed = true;
      }

      // Present alert message about clipboard access not being available
      if (failed || !doc.queryCommandSupported(command)) {
        let msg = editor.translate(
          'Your browser doesn\'t support direct access to the clipboard. ' +
          'Please use the Ctrl+X/C/V keyboard shortcuts instead.'
        );

        if (Env.mac) {
          msg = msg.replace(/Ctrl\+/g, '\u2318+');
        }

        editor.notificationManager.open({ text: msg, type: 'error' });
      }
    },

    // Override unlink command
    'unlink' () {
      if (selection.isCollapsed()) {
        const elm = editor.dom.getParent(editor.selection.getStart(), 'a');
        if (elm) {
          editor.dom.remove(elm, true);
        }

        return;
      }

      formatter.remove('link');
    },

    // Override justify commands to use the text formatter engine
    'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone' (command) {
      let align = command.substring(7);

      if (align === 'full') {
        align = 'justify';
开发者ID:danielpunkass,项目名称:tinymce,代码行数:67,代码来源:EditorCommands.ts


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