PHP Classes

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

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

Contents

Class file image Download
/** * Range.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.Range', [ 'tinymce.core.api.dom.RangeUtils', 'tinymce.plugins.lists.core.NodeType' ], function (RangeUtils, NodeType) { var getNormalizedEndPoint = function (container, offset) { var node = RangeUtils.getNode(container, offset); if (NodeType.isListItemNode(container) && NodeType.isTextNode(node)) { var textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0; return { container: node, offset: textNodeOffset }; } return { container: container, offset: offset }; }; var normalizeRange = function (rng) { var outRng = rng.cloneRange(); var rangeStart = getNormalizedEndPoint(rng.startContainer, rng.startOffset); outRng.setStart(rangeStart.container, rangeStart.offset); var rangeEnd = getNormalizedEndPoint(rng.endContainer, rng.endOffset); outRng.setEnd(rangeEnd.container, rangeEnd.offset); return outRng; }; return { getNormalizedEndPoint: getNormalizedEndPoint, normalizeRange: normalizeRange }; } );