How to use the tinymce/core/api/html/Node function in tinymce

To help you get started, we’ve selected a few tinymce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / FilterContent.ts View on Github external
while (ai--) {
          const attrName = attribs[ai].name;

          if (attrName.indexOf('data-mce-p-') === 0) {
            realElm.attr(attrName.substr(11), attribs[ai].value);
          }
        }

        if (realElmName === 'script') {
          realElm.attr('type', 'text/javascript');
        }

        // Inject innerhtml
        innerHtml = node.attr('data-mce-html');
        if (innerHtml) {
          innerNode = new Node('#text', 3);
          innerNode.raw = true;
          innerNode.value = Sanitize.sanitize(editor, unescape(innerHtml));
          realElm.append(innerNode);
        }

        node.replace(realElm);
      }
    });
  });
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / FilterContent.ts View on Github external
let realElm;
      let ai;
      let attribs;
      let innerHtml;
      let innerNode;
      let realElmName;
      let className;

      while (i--) {
        node = nodes[i];
        if (!node.parent) {
          continue;
        }

        realElmName = node.attr(name);
        realElm = new Node(realElmName, 1);

        // Add width/height to everything but audio
        if (realElmName !== 'audio' && realElmName !== 'script') {
          className = node.attr('class');
          if (className && className.indexOf('mce-preview-object') !== -1) {
            realElm.attr({
              width: node.firstChild.attr('width'),
              height: node.firstChild.attr('height')
            });
          } else {
            realElm.attr({
              width: node.attr('width'),
              height: node.attr('height')
            });
          }
        }
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / Nodes.ts View on Github external
});

  retainAttributesAndInnerHtml(editor, node, previewWrapper);

  previewNode = new Node(name, 1);
  previewNode.attr({
    src: node.attr('src'),
    allowfullscreen: node.attr('allowfullscreen'),
    style: node.attr('style'),
    class: node.attr('class'),
    width: node.attr('width'),
    height: node.attr('height'),
    frameborder: '0'
  });

  shimNode = new Node('span', 1);
  shimNode.attr('class', 'mce-shim');

  previewWrapper.append(previewNode);
  previewWrapper.append(shimNode);

  return previewWrapper;
};
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / Nodes.ts View on Github external
const createPlaceholderNode = function (editor: Editor, node: Node) {
  let placeHolder;
  const name = node.name;

  placeHolder = new Node('img', 1);
  placeHolder.shortEnded = true;

  retainAttributesAndInnerHtml(editor, node, placeHolder);

  placeHolder.attr({
    'width': node.attr('width') || '300',
    'height': node.attr('height') || (name === 'audio' ? '30' : '150'),
    'style': node.attr('style'),
    'src': Env.transparentSrc,
    'data-mce-object': name,
    'class': 'mce-object mce-object-' + name
  });

  return placeHolder;
};
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / Nodes.ts View on Github external
let previewWrapper;
  let previewNode;
  let shimNode;
  const name = node.name;

  previewWrapper = new Node('span', 1);
  previewWrapper.attr({
    'contentEditable': 'false',
    'style': node.attr('style'),
    'data-mce-object': name,
    'class': 'mce-preview-object mce-object-' + name
  });

  retainAttributesAndInnerHtml(editor, node, previewWrapper);

  previewNode = new Node(name, 1);
  previewNode.attr({
    src: node.attr('src'),
    allowfullscreen: node.attr('allowfullscreen'),
    style: node.attr('style'),
    class: node.attr('class'),
    width: node.attr('width'),
    height: node.attr('height'),
    frameborder: '0'
  });

  shimNode = new Node('span', 1);
  shimNode.attr('class', 'mce-shim');

  previewWrapper.append(previewNode);
  previewWrapper.append(shimNode);
github tinymce / tinymce / modules / tinymce / src / plugins / media / main / ts / core / Nodes.ts View on Github external
const createPreviewIframeNode = function (editor: Editor, node: Node) {
  let previewWrapper;
  let previewNode;
  let shimNode;
  const name = node.name;

  previewWrapper = new Node('span', 1);
  previewWrapper.attr({
    'contentEditable': 'false',
    'style': node.attr('style'),
    'data-mce-object': name,
    'class': 'mce-preview-object mce-object-' + name
  });

  retainAttributesAndInnerHtml(editor, node, previewWrapper);

  previewNode = new Node(name, 1);
  previewNode.attr({
    src: node.attr('src'),
    allowfullscreen: node.attr('allowfullscreen'),
    style: node.attr('style'),
    class: node.attr('class'),
    width: node.attr('width'),