本文整理汇总了TypeScript中tinymce/core/api/Editor.getContent函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getContent函数的具体用法?TypeScript getContent怎么用?TypeScript getContent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getContent函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
return Step.sync(() => {
const html = editor.getContent();
Assertions.assertHtml('Editor content should be expected html', content, html);
Assertions.assertEq('Editor should not be dirty', false, editor.isDirty());
Assertions.assertEq('UndoManager should not have any undo levels', false, editor.undoManager.hasUndo());
Assertions.assertEq('UndoManager should not have any redo levels', false, editor.undoManager.hasRedo());
Assertions.assertEq('Editor start content should match the original content', '<p><br data-mce-bogus="1"></p>', editor.startContent);
});
示例2: Date
const storeDraft = (editor: Editor) => {
const prefix = Settings.getAutoSavePrefix(editor);
if (!isEmpty(editor) && editor.isDirty()) {
LocalStorage.setItem(prefix + 'draft', editor.getContent({ format: 'raw', no_events: true }) as string);
LocalStorage.setItem(prefix + 'time', new Date().getTime().toString());
Events.fireStoreDraft(editor);
}
};
示例3: function
const getPreviewHtml = function (editor: Editor) {
let headHtml = '';
const encode = editor.dom.encode;
const contentStyle = Settings.getContentStyle(editor);
headHtml += '<base href="' + encode(editor.documentBaseURI.getURI()) + '">';
if (contentStyle) {
headHtml += '<style type="text/css">' + contentStyle + '</style>';
}
Tools.each(editor.contentCSS, function (url) {
headHtml += '<link type="text/css" rel="stylesheet" href="' + encode(editor.documentBaseURI.toAbsolute(url)) + '">';
});
let bodyId = editor.settings.body_id || 'tinymce';
if (bodyId.indexOf('=') !== -1) {
bodyId = editor.getParam('body_id', '', 'hash');
bodyId = bodyId[editor.id] || bodyId;
}
let bodyClass = editor.settings.body_class || '';
if (bodyClass.indexOf('=') !== -1) {
bodyClass = editor.getParam('body_class', '', 'hash');
bodyClass = bodyClass[editor.id] || '';
}
const preventClicksOnLinksScript = (
'<script>' +
'document.addEventListener && document.addEventListener("click", function(e) {' +
'for (var elm = e.target; elm; elm = elm.parentNode) {' +
'if (elm.nodeName === "A") {' +
'e.preventDefault();' +
'}' +
'}' +
'}, false);' +
'</script> '
);
const directionality = editor.getBody().dir;
const dirAttr = directionality ? ' dir="' + encode(directionality) + '"' : '';
const previewHtml = (
'<!DOCTYPE html>' +
'<html>' +
'<head>' +
headHtml +
'</head>' +
'<body id="' + encode(bodyId) + '" class="mce-content-body ' + encode(bodyClass) + '"' + dirAttr + '>' +
editor.getContent() +
preventClicksOnLinksScript +
'</body>' +
'</html>'
);
return previewHtml;
};
示例4:
editor._scanForImages().then(function (result) {
const blobInfo = result[0].blobInfo;
LegacyUnit.equal('data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64(), testBlobDataUri);
LegacyUnit.equal(editor.getBody().innerHTML, '<p><img src="' + blobInfo.blobUri() + '"></p>');
LegacyUnit.equal(
'<p><img src="data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64() + '" /></p>',
editor.getContent()
);
LegacyUnit.strictEqual(editor.editorUpload.blobCache.get(blobInfo.id()), blobInfo);
}).then(done).catch(fail);
示例5:
Chain.mapper(() => ed.getContent()),