本文整理匯總了TypeScript中tinymce/core/api/util/Delay.setEditorTimeout函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setEditorTimeout函數的具體用法?TypeScript setEditorTimeout怎麽用?TypeScript setEditorTimeout使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setEditorTimeout函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const startTimedUpload = function (editor, imageUploadTimerState) {
const imageUploadTimer = Delay.setEditorTimeout(editor, function () {
editor.editorUpload.uploadImagesAuto();
}, editor.settings.images_upload_timeout || 30000);
imageUploadTimerState.set(imageUploadTimer);
};
示例2: function
editor.on('keypress', function (e: EditorEvent<KeyboardEvent>) {
if (KeyHandler.checkCharCode(charCodes, e)) {
Delay.setEditorTimeout(editor, function () {
KeyHandler.handleInlineKey(editor, patternsState.get());
});
}
});
示例3: function
const startTimedUpload = function (editor: Editor, imageUploadTimerState) {
const imageUploadTimer = Delay.setEditorTimeout(editor, function () {
editor.editorUpload.uploadImagesAuto();
}, Settings.getUploadTimeout(editor));
imageUploadTimerState.set(imageUploadTimer);
};
示例4: function
editor.on('paste', function (e) {
// Getting content from the Clipboard can take some time
const clipboardTimer = new Date().getTime();
const clipboardContent = getClipboardContent(editor, e);
const clipboardDelay = new Date().getTime() - clipboardTimer;
const isKeyBoardPaste = (new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay) < 1000;
const plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
let internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime());
// Reset ephemeral flags
pasteFormat.set(undefined);
keyboardPastePlainTextState = false;
if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
pasteBin.remove();
return;
}
if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
pasteBin.remove();
return;
}
// Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs
if (!isKeyBoardPaste) {
e.preventDefault();
}
// Try IE only method if paste isn't a keyboard paste
if (Env.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
pasteBin.create();
editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
e.stopPropagation();
});
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 {
// Since we never use the pastebin on Red Sweater branch, we want to prevent the default in both cases
// to avoid a double-paste behavior.
e.preventDefault();
Delay.setEditorTimeout(editor, function () {
insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
}, 0);
}
});
示例5: function
suite.asyncTest('setEditorTimeout', function (_, done) {
const fakeEditor = {};
Delay.setEditorTimeout(fakeEditor, function () {
ok(true, 'setEditorTimeout was executed.');
done();
});
});
示例6:
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);
});
示例7: function
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);
});
});
};
示例8: toggle
editor.on('ProgressState', (e) => {
timer.get().each(Delay.clearTimeout);
if (Type.isNumber(e.time)) {
const timerId = Delay.setEditorTimeout(editor, () => toggle(e.state), e.time);
timer.set(Option.some(timerId));
} else {
toggle(e.state);
timer.set(Option.none());
}
});
示例9: resize
const wait = (editor: Editor, oldSize: Cell<number>, 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);
};