How to use the tinymce/core/api/util/Delay.setEditorTimeout function in tinymce

To help you get started, we’ve selected a few tinymce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ContextToolbar.ts View on Github external
editor.on('click keyup SetContent ObjectResized ResizeEditor', (e) => {
      // Fixing issue with chrome focus on img.
      resetTimer(
        Delay.setEditorTimeout(editor, launchContextToolbar, 0)
      );
    });
github tinymce / tinymce / modules / tinymce / src / plugins / paste / main / ts / core / CutCopy.ts View on Github external
setClipboardData(evt, getData(editor), fallback(editor), () => {
      if (Env.browser.isChrome()) {
        const rng = editor.selection.getRng();
        // Chrome fails to execCommand from another execCommand with this message:
        // "We don't execute document.execCommand() this time, because it is called recursively.""
        Delay.setEditorTimeout(editor, () => { // detach
          // Restore the range before deleting, as Chrome on Android will
          // collapse the selection after a cut event has fired.
          editor.selection.setRng(rng);
          editor.execCommand('Delete');
        }, 0);
      } else {
        editor.execCommand('Delete');
      }
    });
  }
github tinymce / tinymce / modules / tinymce / src / plugins / quickbars / main / ts / insert / Picker.ts View on Github external
const cancelHandler = (e) => {
      const cleanup = () => {
        resolve([]);
        fileInput.parentNode.removeChild(fileInput);
      };

      // Android will fire focusin before the input change event
      // so we need to do a slight delay to get outside the event loop
      if (Env.os.isAndroid() && e.type !== 'remove') {
        Delay.setEditorTimeout(editor, cleanup, 0);
      } else {
        cleanup();
      }
      editor.off('focusin remove', cancelHandler);
    };
github tinymce / tinymce / modules / tinymce / src / plugins / paste / main / ts / core / Clipboard.ts View on Github external
editor.getDoc().execCommand('Paste', false, null);
      clipboardContent['text/html'] = pasteBin.getHtml();
    }

    // If clipboard API has HTML then use that directly
    if (hasContentType(clipboardContent, 'text/html')) {
      e.preventDefault();

      // if clipboard lacks internal mime type, inspect html for internal markings
      if (!internal) {
        internal = InternalHtml.isMarked(clipboardContent['text/html']);
      }

      insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
    } else {
      Delay.setEditorTimeout(editor, function () {
        insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
      }, 0);
    }
  });
};
github tinymce / tinymce / modules / tinymce / src / plugins / autoresize / main / ts / core / Resize.ts View on Github external
const wait = (editor: Editor, oldSize: Cell, times: number, interval: number, callback?: Function) => {
  Delay.setEditorTimeout(editor, () => {
    resize(editor, oldSize);

    if (times--) {
      wait(editor, oldSize, times, interval, callback);
    } else if (callback) {
      callback();
    }
  }, interval);
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ContextToolbar.ts View on Github external
editor.on('focusout', (e) => {
      Delay.setEditorTimeout(editor, () => {
        if (Focus.search(sink.element()).isNone() && Focus.search(contextbar.element()).isNone()) {
          lastAnchor.set(Option.none());
          InlineView.hide(contextbar);
        }
      }, 0);
    });
github tinymce / tinymce / modules / tinymce / src / plugins / imagetools / main / ts / core / Actions.ts View on Github external
const startTimedUpload = function (editor: Editor, imageUploadTimerState) {
  const imageUploadTimer = Delay.setEditorTimeout(editor, function () {
    editor.editorUpload.uploadImagesAuto();
  }, Settings.getUploadTimeout(editor));

  imageUploadTimerState.set(imageUploadTimer);
};
github tinymce / tinymce / modules / tinymce / src / plugins / link / main / ts / ui / DialogConfirms.ts View on Github external
const delayedConfirm = function (editor: Editor, message: string, callback: (state: boolean) => void) {
  const rng = editor.selection.getRng();

  Delay.setEditorTimeout(editor, function () {
    editor.windowManager.confirm(message, function (state) {
      editor.selection.setRng(rng);
      callback(state);
    });
  });
};
github tinymce / tinymce / modules / tinymce / src / themes / silver / main / ts / ui / menus / contextmenu / platform / MobileContextMenu.ts View on Github external
const selectionReset = () => {
    Delay.setEditorTimeout(editor, () => {
      editor.selection.setRng(originalSelection);
    }, 10);
    unbindEventListeners();
  };
  editor.once('touchend', selectionReset);