HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/bs.kntsleep.com/system/extend/ueditor/_src/ui/splitbutton.js
///import core
///import uicore
///import ui/stateful.js
(function() {
  var utils = baidu.editor.utils,
    uiUtils = baidu.editor.ui.uiUtils,
    domUtils = baidu.editor.dom.domUtils,
    UIBase = baidu.editor.ui.UIBase,
    Stateful = baidu.editor.ui.Stateful,
    SplitButton = (baidu.editor.ui.SplitButton = function(options) {
      this.initOptions(options);
      this.initSplitButton();
    });
  SplitButton.prototype = {
    popup: null,
    uiName: "splitbutton",
    title: "",
    initSplitButton: function() {
      this.initUIBase();
      this.Stateful_init();
      var me = this;
      if (this.popup != null) {
        var popup = this.popup;
        this.popup = null;
        this.setPopup(popup);
      }
    },
    _UIBase_postRender: UIBase.prototype.postRender,
    postRender: function() {
      this.Stateful_postRender();
      this._UIBase_postRender();
    },
    setPopup: function(popup) {
      if (this.popup === popup) return;
      if (this.popup != null) {
        this.popup.dispose();
      }
      popup.addListener("show", utils.bind(this._onPopupShow, this));
      popup.addListener("hide", utils.bind(this._onPopupHide, this));
      popup.addListener(
        "postrender",
        utils.bind(function() {
          popup
            .getDom("body")
            .appendChild(
              uiUtils.createElementByHtml(
                '<div id="' +
                  this.popup.id +
                  '_bordereraser" class="edui-bordereraser edui-background" style="width:' +
                  (uiUtils.getClientRect(this.getDom()).width + 20) +
                  'px"></div>'
              )
            );
          popup.getDom().className += " " + this.className;
        }, this)
      );
      this.popup = popup;
    },
    _onPopupShow: function() {
      this.addState("opened");
    },
    _onPopupHide: function() {
      this.removeState("opened");
    },
    getHtmlTpl: function() {
      return (
        '<div id="##" class="edui-box %%">' +
        "<div " +
        (this.title ? 'title="' + this.title + '"' : "") +
        ' id="##_state" stateful><div class="%%-body">' +
        '<div id="##_button_body" class="edui-box edui-button-body" onclick="$$._onButtonClick(event, this);">' +
        '<div class="edui-box edui-icon"></div>' +
        "</div>" +
        '<div class="edui-box edui-splitborder"></div>' +
        '<div class="edui-box edui-arrow" onclick="$$._onArrowClick();"></div>' +
        "</div></div></div>"
      );
    },
    showPopup: function() {
      // 当popup往上弹出的时候,做特殊处理
      var rect = uiUtils.getClientRect(this.getDom());
      rect.top -= this.popup.SHADOW_RADIUS;
      rect.height += this.popup.SHADOW_RADIUS;
      this.popup.showAnchorRect(rect);
    },
    _onArrowClick: function(event, el) {
      if (!this.isDisabled()) {
        this.showPopup();
      }
    },
    _onButtonClick: function() {
      if (!this.isDisabled()) {
        this.fireEvent("buttonclick");
      }
    }
  };
  utils.inherits(SplitButton, UIBase);
  utils.extend(SplitButton.prototype, Stateful, true);
})();