VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol-acomp__js__ckeditor__CKInlineShortText.js
/*** module: node_modules/absol-acomp/js/ckeditor/CKInlineShortText.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _ACore = _interopRequireWildcard(require("../../ACore"));

var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP"));

var _CKPlaceholder = _interopRequireDefault(require("./CKPlaceholder"));

var _Array = require("absol/src/DataStructure/Array");

var _plugins = require("./plugins");

var _Dom = _interopRequireWildcard(require("absol/src/HTML5/Dom"));

var _file = require("absol/src/Converter/file");

var _stringGenerate = require("absol/src/String/stringGenerate");




/***
 * @extends CKPlaceholder
 * @constructor
 */
function CKInlineShortText() {
  _CKPlaceholder.default.call(this);

  this.once('editorcreated', this.eventHandler.afterEditorCreated).on('paste', this.eventHandler.paste, true).once('editorready', this.eventHandler.afterEditorReady);
}

_OOP.default.mixClass(CKInlineShortText, _CKPlaceholder.default);

CKInlineShortText.tag = 'CKInlineShortText'.toLowerCase();
CKInlineShortText.property = Object.assign({}, _CKPlaceholder.default.property);
CKInlineShortText.eventHandler = Object.assign({}, _CKPlaceholder.default.eventHandler);

CKInlineShortText.render = function () {
  return (0, _ACore._)({
    class: 'as-ck-inline-short-text',
    extendEvent: ['editorcreated', 'editorready', 'change', 'command'],
    id: (0, _stringGenerate.randomIdent)(8),
    attr: {
      contenteditable: 'true'
    }
  });
};

CKInlineShortText.prototype.mode = 'inline';

CKInlineShortText.prototype._makeInitConfig = function () {
  var config = {
    toolbar: [{
      name: 'extension',
      items: (0, _Array.arrayRemoveNone)(this._extensions.map(function (eName) {
        if (_plugins.CKExtensionDict[eName] && _plugins.CKExtensionDict[eName].command) {
          return _plugins.CKExtensionDict[eName].command;
        }
      }))
    }],
    keystrokes: [[13
    /* Enter */
    , 'blur'], [CKEDITOR.SHIFT + 13
    /* Shift + Enter */
    , 'blur']]
  };
  return config;
};

CKInlineShortText.property.extensions = Object.assign({}, _CKPlaceholder.default.property.extensions, {
  set: function (value) {
    value = value || [];
    value.push('simple_text');
    value = (0, _Array.arrayUnique)(value);

    _CKPlaceholder.default.property.extensions.set.call(this, value);

    this._config = this._makeInitConfig();
  }
});

CKInlineShortText.prototype._hookScroll = function () {
  this.$scrollers = [];
  var c = this.parentElement;

  while (c) {
    this.$scrollers.push(c);
    c = c.parentElement;
  }

  this.$scrollers.push(document);
  this.$scrollers.forEach(function (elt) {
    elt.addEventListener('scroll', this.eventHandler.scroll);
  }.bind(this));
};

CKInlineShortText.prototype._unhookScroll = function () {
  this.$scrollers.forEach(function (elt) {
    elt.removeEventListener('scroll', this.eventHandler.scroll);
  }.bind(this));
};

CKInlineShortText.eventHandler.afterEditorCreated = function () {
  this.editor.on('paste', function (evt) {
    evt.cancel();
  });
};

CKInlineShortText.eventHandler.afterEditorReady = function () {
  this.$toolbarElt = this.$toolbarElt || (0, _ACore.$)('#cke_' + this.attr('id'));
  this['removeToolbar'] = this.removeToolbar;

  this._hookScroll();

  setTimeout(this.eventHandler.tick, 5000);
};

CKInlineShortText.eventHandler.paste = function (event) {
  var self = this;
  var clipboardData = event.clipboardData || window.clipboardData;
  /**Safari bug */

  event.preventDefault();

  if (clipboardData) {
    if (clipboardData.items) {
      var items = Array.prototype.slice.call(clipboardData.items);
      var plainTextItems = items.filter(function (item) {
        return item.type.indexOf('text/plain') >= 0;
      });

      if (plainTextItems.length > 0) {
        var plainTextItem = plainTextItems[0]; //only one item

        plainTextItem.getAsString(function (text) {
          self.editor.insertHtml(self._implicit(text));
        });
      }
    } else {
      var text = event.clipboardData.getData('text/plain');

      if (text) {
        self.editor.insertHtml(self._implicit(text));
      }
    }
  }
};

CKInlineShortText.eventHandler.tick = function () {
  if (!this.isDescendantOf(document.body)) {
    this._unhookScroll();

    return;
  }

  setTimeout(this.eventHandler.tick, 5000);
};
/***
 * @this CKInlineShortText
 */


CKInlineShortText.eventHandler.scroll = function () {
  // If we don't have any active instance of CKEDITOR - return
  if (!CKEDITOR.currentInstance) {
    return;
  }

  if (CKEDITOR.currentInstance.element.$ !== this) return; // Save the elements we need to work with

  if (!this.isDescendantOf(document.body)) {
    this._unhookScroll();

    return;
  }

  this.$toolbarElt = this.$toolbarElt || (0, _ACore.$)('#cke_' + this.attr('id'));
  var toolbarElt = this.$toolbarElt;
  if (!toolbarElt) return;
  var bound = this.getBoundingClientRect();
  var toolBound = toolbarElt.getBoundingClientRect();
  var outbound = (0, _Dom.traceOutBoundingClientRect)(this);
  var left = Math.max(0, bound.left);
  var top = bound.top - toolBound.height;

  if (outbound.top > bound.bottom || outbound.bottom < bound.top) {
    top = -1000;
  } else if (bound.top < toolBound.height) {
    top = bound.bottom;
  }

  toolbarElt.addStyle({
    top: top + 'px',
    left: left + 'px'
  });
};

CKInlineShortText.property.removeToolbar = {
  set: function (value) {
    this._removeToolbar = !!value;

    if (this.$toolbarElt) {
      if (this._removeToolbar) {
        this.$toolbarElt.addClass('as-hidden');
      } else {
        this.$toolbarElt.removeClass('as-hidden');
      }
    }
  },
  get: function () {
    return this._removeToolbar;
  }
};

_ACore.default.install(CKInlineShortText);

var _default = CKInlineShortText;
exports.default = _default;

VaKeR 2022