PHP Classes

File: public/js/tinymce/src/plugins/visualchars/src/main/js/core/Nodes.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/visualchars/src/main/js/core/Nodes.js   Download  
File: public/js/tinymce/src/plugins/visualchars/src/main/js/core/Nodes.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,616 bytes
 

Contents

Class file image Download
/** * Nodes.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.plugins.visualchars.core.Nodes', [ 'ephox.katamari.api.Arr', 'ephox.sugar.api.node.Element', 'ephox.sugar.api.node.Node', 'tinymce.plugins.visualchars.core.Data', 'tinymce.plugins.visualchars.core.Html' ], function (Arr, Element, Node, Data, Html) { var isMatch = function (n) { return Node.isText(n) && Node.value(n) !== undefined && Data.regExp.test(Node.value(n)); }; // inlined sugars PredicateFilter.descendants for file size var filterDescendants = function (scope, predicate) { var result = []; var dom = scope.dom(); var children = Arr.map(dom.childNodes, Element.fromDom); Arr.each(children, function (x) { if (predicate(x)) { result = result.concat([ x ]); } result = result.concat(filterDescendants(x, predicate)); }); return result; }; var findParentElm = function (elm, rootElm) { while (elm.parentNode) { if (elm.parentNode === rootElm) { return elm; } elm = elm.parentNode; } }; var replaceWithSpans = function (html) { return html.replace(Data.regExpGlobal, Html.wrapCharWithSpan); }; return { isMatch: isMatch, filterDescendants: filterDescendants, findParentElm: findParentElm, replaceWithSpans: replaceWithSpans }; } );