本文整理汇总了TypeScript中tinymce/plugins/paste/api/Clipboard.Clipboard函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Clipboard函数的具体用法?TypeScript Clipboard怎么用?TypeScript Clipboard使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Clipboard函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.asyncTest('pasteImages should set unique id in blobcache', function (editor, done, die) {
let rng, event;
const clipboard = Clipboard(editor, Cell('html'));
const hasCachedItem = (name) => !!editor.editorUpload.blobCache.get(name);
editor.settings.paste_data_images = true;
rng = setupContent(editor);
event = mockEvent('paste', [
base64ToBlob(base64ImgSrc, 'image/gif'),
base64ToBlob(base64ImgSrc2, 'image/gif')
]);
clipboard.pasteImageData(event, rng);
waitForSelector(editor, 'img').then(function () {
waitFor((editor) => hasCachedItem('mceclip0') && hasCachedItem('mceclip1')).then(() => {
const cachedBlob1 = editor.editorUpload.blobCache.get('mceclip0');
const cachedBlob2 = editor.editorUpload.blobCache.get('mceclip1');
LegacyUnit.equal(base64ImgSrc, cachedBlob1.base64());
LegacyUnit.equal(base64ImgSrc2, cachedBlob2.base64());
done();
}).catch(die);
}).catch(die);
});
示例2: function
suite.asyncTest('pasteImages', function (editor, done, die) {
let rng, event;
const clipboard = Clipboard(editor, Cell('html'));
editor.settings.paste_data_images = true;
rng = setupContent(editor);
event = mockEvent('paste');
clipboard.pasteImageData(event, rng);
waitForSelector(editor, 'img').then(function () {
LegacyUnit.equal(editor.getContent(), '<p><img src=\"data:image/gif;base64,' + base64ImgSrc + '" />a</p>');
LegacyUnit.strictEqual(editor.dom.select('img')[0].src.indexOf('blob:'), 0);
done();
}).catch(die);
});