PHP Classes

File: public/js/tinymce/src/core/src/main/js/selection/WordSelection.js

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

Contents

Class file image Download
/** * WordSelection.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.core.selection.WordSelection', [ 'ephox.katamari.api.Type', 'tinymce.core.caret.CaretContainer', 'tinymce.core.caret.CaretPosition' ], function (Type, CaretContainer, CaretPosition) { var hasSelectionModifyApi = function (editor) { return Type.isFunction(editor.selection.getSel().modify); }; var moveRel = function (forward, selection, pos) { var delta = forward ? 1 : -1; selection.setRng(CaretPosition(pos.container(), pos.offset() + delta).toRange()); selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word'); return true; }; var moveByWord = function (forward, editor) { var rng = editor.selection.getRng(); var pos = forward ? CaretPosition.fromRangeEnd(rng) : CaretPosition.fromRangeStart(rng); if (!hasSelectionModifyApi(editor)) { return false; } else if (forward && CaretContainer.isBeforeInline(pos)) { return moveRel(true, editor.selection, pos); } else if (!forward && CaretContainer.isAfterInline(pos)) { return moveRel(false, editor.selection, pos); } else { return false; } }; return { hasSelectionModifyApi: hasSelectionModifyApi, moveByWord: moveByWord }; } );