![]() 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 : |
/*** module: node_modules/absol-brace/BraceExternal/ext/goto.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoToCommand = void 0; var _BCore = require("../../components/BCore"); var _OnsScreenWindow = _interopRequireDefault(require("absol-acomp/js/OnsScreenWindow")); var _WindowBox = _interopRequireDefault(require("absol-acomp/js/WindowBox")); var _FlexiconButton = _interopRequireDefault(require("absol-acomp/js/FlexiconButton")); var _keyboard = require("absol/src/Input/keyboard"); require("absol-acomp/css/common.css"); var _Dom = require("absol/src/HTML5/Dom"); var _Modal = _interopRequireDefault(require("absol-acomp/js/Modal")); var _EventEmitter = require("absol/src/HTML5/EventEmitter"); function openGoToDialog(editor) { var zIndex = 0; var maxZIndex = 0; var container = editor.container; var c = container; var screenSize = (0, _Dom.getScreenSize)(); while (c) { zIndex = parseFloat(getComputedStyle(c).zIndex); if (!isNaN(zIndex)) maxZIndex = Math.max(maxZIndex, zIndex); c = c.parentElement; } var editorBound = container.getBoundingClientRect(); var cursor = editor.getCursorPosition(); var modal = (0, _BCore._)({ tag: _Modal.default, style: { zIndex: maxZIndex + 1000 }, child: { tag: _OnsScreenWindow.default, style: { width: 'auto', height: 'auto', minWidth: '228px', minHeight: '102px', zIndex: maxZIndex + 1005, top: Math.max(0, Math.min(screenSize.height - 50, editorBound.top + editorBound.height / 2 - 50)) + 'px', left: Math.max(0, Math.min(screenSize.width - 276, editorBound.left + editorBound.width / 2 - 276 / 2)) + 'px' } } }); /*** * * @type {WindowBox} */ var windowBox = (0, _BCore._)({ elt: (0, _BCore.$)(_WindowBox.default.tag, modal), class: 'ace_window_box', style: { fontSize: '14px' }, child: [{ style: { padding: '5px', whiteSpace: 'nowrap' }, child: ['<span>Line[:Column] </span>', { tag: 'input', class: 'as-text-input', attr: { type: 'text' }, style: { width: '180px' }, props: { value: [cursor.row + 1, cursor.column + 1].join(':') } }] }, { style: { padding: '5px', whiteSpace: 'nowrap', textAlign: 'center' }, child: [{ tag: _FlexiconButton.default, class: 'primary', style: { minWidth: '80px', marginRight: '20px' }, props: { text: 'OK' } }, { tag: _FlexiconButton.default, style: { minWidth: '80px' }, props: { text: 'CANCEL' } }] }], props: { windowActions: [{ icon: '<span class="material-icons close">close</span>', name: 'close' }] }, on: { action: event => { if (event.actionData.name === 'close') { cancel(); } } } }); var finish = () => { modal.selfRemove(); }; var cancel = () => { finish(); editor.focus(); }; var ok = () => { var textParts = numInput.value.split(':').map(t => t.trim()); var pos = null; var r, c; if (textParts.length === 1 || textParts.length === 2) { r = parseInt(textParts[0]); if (textParts.length === 2) { c = parseInt(textParts[1]); } else { c = 1; } if (!isNaN(r) && !isNaN(c)) { pos = [Math.max(r, 1), Math.max(c, 1)]; } } if (pos) { finish(); editor.gotoLine(pos[0], pos[1] - 1); editor.focus(); } else { numInput.focus(); numInput.select(); } }; windowBox.windowTitle = "Go To Line:Column"; modal.addTo(document.body); var numInput = (0, _BCore.$)('.as-text-input', windowBox); var $buttons = (0, _BCore.$$)(_FlexiconButton.default.tag, windowBox); $buttons[0].on('click', ok); $buttons[1].on('click', cancel); modal.on('mouseup', event => { if ((0, _EventEmitter.hitElement)(numInput, event) || (0, _EventEmitter.hitElement)($buttons[0], event) || (0, _EventEmitter.hitElement)($buttons[1], event)) return; setTimeout(() => { if (modal.parentElement) { numInput.focus(); numInput.select(); } }, 50); }); [numInput].concat($buttons).forEach((ctrElt, i, arr) => { ctrElt.on('keydown', event => { var nextElt; var key = (0, _keyboard.keyboardEventToKeyBindingIdent)(event); if (key === 'tab') { event.preventDefault(); nextElt = arr[(i + 1) % arr.length]; if (nextElt.$input) { nextElt.$input.focus(); nextElt.$input.select(); } else { nextElt.focus(); } } else if (key === 'enter') { setTimeout(ok, 100); } else if (key === 'escape') { cancel(); } }); }); setTimeout(() => { numInput.focus(); numInput.select(); }, 100); } var GoToCommand = { name: "goto", exec: openGoToDialog, bindKey: { win: "Ctrl-G", mac: 'Command-G' } }; exports.GoToCommand = GoToCommand;