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


TypeScript Editor.convertURL方法代码示例

本文整理汇总了TypeScript中tinymce/core/api/Editor.Editor.convertURL方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor.convertURL方法的具体用法?TypeScript Editor.convertURL怎么用?TypeScript Editor.convertURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tinymce/core/api/Editor.Editor的用法示例。


在下文中一共展示了Editor.convertURL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

const retainAttributesAndInnerHtml = function (editor: Editor, sourceNode: Node, targetNode: Node) {
  let attrName;
  let attrValue;
  let attribs;
  let ai;
  let innerHtml;

  // Prefix all attributes except width, height and style since we
  // will add these to the placeholder
  attribs = sourceNode.attributes;
  ai = attribs.length;
  while (ai--) {
    attrName = attribs[ai].name;
    attrValue = attribs[ai].value;

    if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style') {
      if (attrName === 'data' || attrName === 'src') {
        attrValue = editor.convertURL(attrValue, attrName);
      }

      targetNode.attr('data-mce-p-' + attrName, attrValue);
    }
  }

  // Place the inner HTML contents inside an escaped attribute
  // This enables us to copy/paste the fake object
  innerHtml = sourceNode.firstChild && sourceNode.firstChild.value;
  if (innerHtml) {
    targetNode.attr('data-mce-html', escape(Sanitize.sanitize(editor, innerHtml)));
    targetNode.firstChild = null;
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:32,代码来源:Nodes.ts

示例2: function

  parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) {
    let i = nodes.length, node;
    const dom = editor.dom;
    let value, internalName;

    while (i--) {
      node = nodes[i];
      value = node.attr(name);
      internalName = 'data-mce-' + name;

      // Add internal attribute if we need to we don't on a refresh of the document
      if (!node.attributes.map[internalName]) {
        // Don't duplicate these since they won't get modified by any browser
        if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) {
          continue;
        }

        if (name === 'style') {
          value = dom.serializeStyle(dom.parseStyle(value), node.name);

          if (!value.length) {
            value = null;
          }

          node.attr(internalName, value);
          node.attr(name, value);
        } else if (name === 'tabindex') {
          node.attr(internalName, value);
          node.attr(name, null);
        } else {
          node.attr(internalName, editor.convertURL(value, name, node.name));
        }
      }
    }
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:35,代码来源:InitContentBody.ts

示例3: function

  const replaceImageUri = function (image: HTMLImageElement, resultUri: string) {
    blobCache.removeByUri(image.src);
    replaceUrlInUndoStack(image.src, resultUri);

    editor.$(image).attr({
      'src': Settings.shouldReuseFileName(editor) ? resultUri + cacheInvalidator() : resultUri,
      'data-mce-src': editor.convertURL(resultUri, 'src')
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:EditorUpload.ts


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