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__blockeditor__BlockEditorCmd.js
/*** module: node_modules/absol-form/js/blockeditor/BlockEditorCmd.js ***/
"use strict";

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

var _BEEntry = _interopRequireDefault(require("./types/BEEntry"));

var _BEFunction = _interopRequireDefault(require("./types/BEFunction"));

var _BERadioGroup = _interopRequireDefault(require("./types/BERadioGroup"));

var _BEPropsGate = _interopRequireDefault(require("./types/BEPropsGate"));

var _BETimer = _interopRequireDefault(require("./types/BETimer"));

var _BESnackBar = _interopRequireDefault(require("./types/BESnackBar"));

var _BEFileDownloader = _interopRequireDefault(require("./types/BEFileDownloader"));

var _BEBase = _interopRequireDefault(require("./types/BEBase"));

var _utils = require("../core/utils");

var _utils2 = require("absol-acomp/js/utils");


var BlockEditorCmd = {};

BlockEditorCmd.preview = function () {
  this.layoutEditor.execCmd('preview');
};

BlockEditorCmd.delete = function () {
  var blocks = this.activatedBlocks.slice();

  for (var i = 0; i < blocks.length; ++i) {
    this.deleteBlock(blocks[i]);
  }
};

BlockEditorCmd.copy = function () {
  this.setClipboardBlocks(this.activatedBlocks);
};

BlockEditorCmd.save = function () {
  this.layoutEditor.execCmd('save');
};

BlockEditorCmd.paste = function () {
  var rawBlocks = this.getClipboardBlocks();
  if (!rawBlocks) return;
  var self = this;
  rawBlocks.forEach(function (rawBlock, i) {
    var clazz = _BEBase.default.prototype.tag2Class[rawBlock.tag] || _BEBase.default;
    var block = new clazz(this);
    block.on('select', function (event) {
      if (self.isActivatedBlock(block)) {
        if (event.shiftKey && self.activatedBlocks.length > 1) {
          self.deactivateBlock(block);
        } else self.activateBlock(block);
      } else {
        self.activateBlock(block, event.shiftKey);
      }
    });
    this.$body.addChild(block.getView());
    this.blocks.push(block);
    if (i + 1 === rawBlocks.length) (0, _utils2.vScrollIntoView)(block.getView());
    var id = rawBlock.attributes && rawBlock.attributes.id || (0, _utils.randomUniqueIdent)();
    var idPart;
    var idNum;

    if (self.findBlockById(id)) {
      idPart = id.split('_');
      idNum = parseInt(idPart[idPart.length - 1]);

      if (isNaN(idNum)) {
        idPart.push(0);
        idNum = 1;
      }

      idPart[idPart.length - 1] = idNum;
      id = idPart.join('_');

      while (self.findBlockById(id)) {
        idNum++;
        idPart[idPart.length - 1] = idNum;
        id = idPart.join('_');
      }

      rawBlock.attributes = rawBlock.attributes || {};
      rawBlock.attributes.id = id;
    }

    if (rawBlock.attributes && rawBlock.attributes.permissions && rawBlock.attributes.permissions.edit_attributes) {
      delete rawBlock.attributes.permissions.edit_attributes;
    }

    block.setData(rawBlock);
    this.activateBlock(block, i > 0);
  }.bind(this));
  this.notifyUnsaved();
};

var BlockEditorCmdTree = [['preview'], ['save'], [// 'cut',
'copy', 'paste', 'delete'], [_BEEntry.default, _BEFunction.default, _BERadioGroup.default, _BEPropsGate.default, _BETimer.default, _BESnackBar.default, _BEFileDownloader.default].map(function (clazz) {
  return 'insert_' + clazz.prototype.tag;
})];
exports.BlockEditorCmdTree = BlockEditorCmdTree;
var BlockEditorCmdDescriptors = {
  preview: {
    type: 'trigger',
    icon: 'span.mdi.mdi-play',
    desc: 'Preview',
    bindKey: {
      win: 'Ctrl-K',
      mac: 'TODO?'
    }
  },
  save: {
    type: 'trigger',
    icon: 'span.mdi.mdi-content-save',
    desc: 'Save',
    bindKey: {
      win: 'Ctrl-S',
      mac: '//todo'
    }
  },
  cut: {
    type: 'trigger',
    icon: 'span.mdi.mdi-content-cut',
    desc: 'Cut',
    bindKey: {
      win: 'Ctrl-X',
      mac: 'TODO?'
    }
  },
  copy: {
    type: 'trigger',
    icon: 'span.mdi.mdi-content-copy',
    desc: 'Copy',
    bindKey: {
      win: 'Ctrl-C',
      mac: 'TODO?'
    }
  },
  paste: {
    type: 'trigger',
    icon: 'span.mdi.mdi-content-paste',
    desc: 'Paste',
    bindKey: {
      win: 'Ctrl-V',
      mac: 'TODO?'
    }
  },
  delete: {
    type: 'trigger',
    icon: 'span.mdi.mdi-delete-variant',
    desc: 'Delete',
    bindKey: {
      win: 'Delete',
      mac: 'Delete'
    }
  }
};
exports.BlockEditorCmdDescriptors = BlockEditorCmdDescriptors;
[_BEEntry.default, _BEFunction.default, _BERadioGroup.default, _BEPropsGate.default, _BETimer.default, _BESnackBar.default, _BEFileDownloader.default].forEach(function (clazz) {
  BlockEditorCmdDescriptors['insert_' + clazz.prototype.tag] = {
    type: 'trigger',
    icon: clazz.prototype.menuIcon,
    desc: "Insert " + clazz.prototype.tag
  };

  BlockEditorCmd['insert_' + clazz.prototype.tag] = function () {
    var block = new clazz(this);
    var self = this;
    block.on('select', function (event) {
      if (self.isActivatedBlock(block)) {
        if (event.shiftKey && self.activatedBlocks.length > 1) {
          self.deactivateBlock(block);
        } else self.activateBlock(block);
      } else {
        self.activateBlock(block, event.shiftKey);
      }
    });
    this.$body.addChild(block.getView());
    this.blocks.push(block);
    (0, _utils2.vScrollIntoView)(block.getView());
    block.setData({
      attributes: {
        id: (0, _utils.randomUniqueIdent)()
      }
    });
    this.activateBlock(block);
    this.notifyUnsaved();
  };
});
var _default = BlockEditorCmd;
exports.default = _default;

VaKeR 2022