PHP Classes

File: public/js/tinymce/src/plugins/lists/src/main/js/core/NormalizeLists.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/lists/src/main/js/core/NormalizeLists.js   Download  
File: public/js/tinymce/src/plugins/lists/src/main/js/core/NormalizeLists.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,585 bytes
 

Contents

Class file image Download
/** * NormalizeLists.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.lists.core.NormalizeLists', [ 'tinymce.core.dom.DOMUtils', 'tinymce.core.util.Tools', 'tinymce.plugins.lists.core.NodeType' ], function (DOMUtils, Tools, NodeType) { var DOM = DOMUtils.DOM; var normalizeList = function (dom, ul) { var sibling, parentNode = ul.parentNode; // Move UL/OL to previous LI if it's the only child of a LI if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) { sibling = parentNode.previousSibling; if (sibling && sibling.nodeName === 'LI') { sibling.appendChild(ul); if (NodeType.isEmpty(dom, parentNode)) { DOM.remove(parentNode); } } else { DOM.setStyle(parentNode, 'listStyleType', 'none'); } } // Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4 if (NodeType.isListNode(parentNode)) { sibling = parentNode.previousSibling; if (sibling && sibling.nodeName === 'LI') { sibling.appendChild(ul); } } }; var normalizeLists = function (dom, element) { Tools.each(Tools.grep(dom.select('ol,ul', element)), function (ul) { normalizeList(dom, ul); }); }; return { normalizeList: normalizeList, normalizeLists: normalizeLists }; } );