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-form__js__kfeditor__KFECmd.js
/*** module: node_modules/absol-form/js/kfeditor/KFECmd.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var KFECmd = {};
KFECmd.save = {
  exec: function () {
    localStorage.setItem("test_data", this.getData());
  }
};
KFECmd.undo = {
  /**
   * @this {KFEditor}
   */
  descriptor: function () {
    return {
      disabled: !this.undoMng.canUndo()
    };
  },

  /**
   * @this {KFEditor}
   */
  exec: function () {
    this.undoMng.undo();
  }
};
KFECmd.redo = {
  /**
   * @this {KFEditor}
   */
  descriptor: function () {
    return {
      disabled: !this.undoMng.canRedo()
    };
  },

  /**
   * @this {KFEditor}
   */
  exec: function () {
    this.undoMng.redo();
  }
};
KFECmd.formatTextBold = {
  /**
   * @this {KFEditor}
   */
  exec: function (flag) {
    if (flag) {
      this.engine.formatRange('fontWeight', 'bold');
    } else {
      this.engine.formatRange('fontWeight', null);
    }

    this.cmdDelegate.updateVisibility();
    this.engine.focusRanges();
  },

  /**
   * @this {KFEditor}
   */
  descriptor: function () {
    var res = {
      checked: false
    };
    var ranges = this.engine.getRanges();
    var range = ranges && ranges[0];
    if (!range) return res;
    var computedStyle = range.computedStyle;

    if (!computedStyle) {
      //cache
      computedStyle = this.engine.computeRangeFormat(range);
      range.computedStyle = computedStyle;
    }

    if (computedStyle.fontWeight) {
      res.checked = computedStyle.fontWeight === 'bold';
    }

    return res;
  }
};
KFECmd.formatTextItalic = {
  /**
   * @this {KFEditor}
   */
  exec: function (flag) {
    if (flag) {
      this.engine.formatRange('fontStyle', 'italic');
    } else {
      this.engine.formatRange('fontStyle', null);
    }

    this.cmdDelegate.updateVisibility();
    this.engine.focusRanges();
  },

  /**
   * @this {KFEditor}
   */
  descriptor: function () {
    var res = {
      checked: false
    };
    var ranges = this.engine.getRanges();
    var range = ranges && ranges[0];
    if (!range) return res;
    var computedStyle = range.computedStyle;

    if (!computedStyle) {
      //cache
      computedStyle = this.engine.computeRangeFormat(range);
      range.computedStyle = computedStyle;
    }

    if (computedStyle.fontWeight) {
      res.checked = computedStyle.fontStyle === 'italic';
    }

    return res;
  }
};
KFECmd.formatTextAlignLeft = {
  /**
   * @this {KFEditor}
   */
  exec: function () {
    this.engine.formatRange('textAlign', 'left');
    this.cmdDelegate.updateVisibility();
    this.engine.focusRanges();
  },

  /**
   * @this {KFEditor}
   */
  descriptor: function () {
    var res = {
      checked: false
    };
    var ranges = this.engine.getRanges();
    var range = ranges && ranges[0];
    if (!range) return {
      checked: false
    };
    var lcaNode = this.engine.lcaOf(range.startContainer, range.endContainer);
    var boundElt = this.engine.paragraphOf(lcaNode) || this.engine.hardBlockOf(lcaNode);
    var cpStyle = getComputedStyle(boundElt);
    var textAlign = cpStyle.getPropertyValue('text-align'); //todo: other type

    res.checked = ['left', 'start'].indexOf(textAlign) >= 0;
    return res;
  }
};
KFECmd.formatTextAlignCenter = {
  /**
   * @this {KFEditor}
   */
  exec: function () {
    this.engine.formatRange('textAlign', 'center');
    this.cmdDelegate.updateVisibility();
    this.engine.focusRanges();
  },

  /**
   * @this {KFEditor}
   */
  descriptor: function () {
    var res = {
      checked: false
    };
    var ranges = this.engine.getRanges();
    var range = ranges && ranges[0];
    if (!range) return {
      checked: false
    };
    var lcaNode = this.engine.lcaOf(range.startContainer, range.endContainer);
    var boundElt = this.engine.paragraphOf(lcaNode) || this.engine.hardBlockOf(lcaNode);
    var cpStyle = getComputedStyle(boundElt);
    var textAlign = cpStyle.getPropertyValue('text-align'); //todo: other type

    res.checked = ['center'].indexOf(textAlign) >= 0;
    return res;
  }
};
KFECmd.formatTextAlignRight = {
  descriptor: function () {
    var res = {
      checked: false
    };
    var ranges = this.engine.getRanges();
    var range = ranges && ranges[0];
    if (!range) return {
      checked: false
    };
    var lcaNode = this.engine.lcaOf(range.startContainer, range.endContainer);
    var boundElt = this.engine.paragraphOf(lcaNode) || this.engine.hardBlockOf(lcaNode);
    var cpStyle = getComputedStyle(boundElt);
    var textAlign = cpStyle.getPropertyValue('text-align'); //todo: other type

    res.checked = ['right', 'end'].indexOf(textAlign) >= 0;
    return res;
  },

  /**
   * @this {KFEditor}
   */
  exec: function () {
    this.engine.formatRange('textAlign', 'right');
    this.cmdDelegate.updateVisibility();
    this.engine.focusRanges();
  }
};
KFECmd.insertImage = {
  /**
   * @this {KFEditor}
   */
  exec: function () {
    this.engine.insert({
      tag: 'image',
      attr: {
        src: 'https://absol.cf/share/8TEb9p4ec.jpg'
      }
    });
  }
};
var _default = KFECmd;
exports.default = _default;

VaKeR 2022