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


TypeScript Editor.getContent函数代码示例

本文整理汇总了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);
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:EditorResetContentTest.ts

示例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);
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:Storage.ts

示例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;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:57,代码来源:IframeContent.ts

示例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);
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:EditorUploadTest.ts

示例5:

 Chain.mapper(() => ed.getContent()),
开发者ID:tinymce,项目名称:tinymce,代码行数:1,代码来源:AnnotationPersistenceTest.ts


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