PHP Classes

File: public/js/tinymce/src/core/src/main/js/newline/ContextSelectors.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra  >  GoLavaCMS  >  public/js/tinymce/src/core/src/main/js/newline/ContextSelectors.js  >  Download  
File: public/js/tinymce/src/core/src/main/js/newline/ContextSelectors.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: 4 years ago
Size: 1,122 bytes
 

Contents

Class file image Download
/**
 * ContextSelectors.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.newline.ContextSelectors',
  [
    'ephox.sugar.api.node.Element',
    'ephox.sugar.api.search.Selectors',
    'tinymce.core.api.Settings',
    'tinymce.core.newline.NewLineUtils'
  ],
  function (Element, Selectors, Settings, NewLineUtils) {
    var matchesSelector = function (editor, selector) {
      return NewLineUtils.getParentBlock(editor).filter(function (parentBlock) {
        return selector.length > 0 && Selectors.is(Element.fromDom(parentBlock), selector);
      }).isSome();
    };

    var shouldInsertBr = function (editor) {
      return matchesSelector(editor, Settings.getBrNewLineSelector(editor));
    };

    var shouldBlockNewLine = function (editor) {
      return matchesSelector(editor, Settings.getNoNewLineSelector(editor));
    };

    return {
      shouldInsertBr: shouldInsertBr,
      shouldBlockNewLine: shouldBlockNewLine
    };
  }
);
For more information send a message to info at phpclasses dot org.