mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 21:55:59 +00:00
fixed editor
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
category: 'Data grid',
|
||||
name: 'Copy to clipboard',
|
||||
keyText: 'Ctrl+C',
|
||||
disableHandleKeyText: 'Ctrl+C',
|
||||
testEnabled: () => getCurrentDataGrid() != null,
|
||||
onClick: () => getCurrentDataGrid().copyToClipboard(),
|
||||
});
|
||||
@@ -1051,6 +1052,7 @@
|
||||
invalidateCommands();
|
||||
}}
|
||||
on:paste={handlePaste}
|
||||
on:copy={copyToClipboard}
|
||||
/>
|
||||
<table
|
||||
class="table"
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
category: 'Data grid',
|
||||
name: 'Copy to clipboard',
|
||||
keyText: 'Ctrl+C',
|
||||
disableHandleKeyText: 'Ctrl+C',
|
||||
testEnabled: () => getCurrentDataForm() != null,
|
||||
onClick: () => getCurrentDataForm().copyToClipboard(),
|
||||
});
|
||||
@@ -353,6 +354,7 @@
|
||||
function createMenu() {
|
||||
return [
|
||||
{ command: 'dataForm.switchToTable' },
|
||||
{ command: 'dataForm.copyToClipboard' },
|
||||
{ divider: true },
|
||||
{ command: 'dataForm.filterSelected' },
|
||||
{ command: 'dataForm.addToFilter' },
|
||||
@@ -526,6 +528,7 @@
|
||||
invalidateCommands();
|
||||
}}
|
||||
on:keydown={handleKeyDown}
|
||||
on:copy={copyToClipboard}
|
||||
/>
|
||||
</div>
|
||||
{#if rowCountInfo}
|
||||
|
||||
@@ -52,6 +52,10 @@
|
||||
let clientWidth;
|
||||
let clientHeight;
|
||||
|
||||
const stdOptions = {
|
||||
showPrintMargin: false,
|
||||
};
|
||||
|
||||
$: theme = $currentThemeDefinition?.themeType == 'dark' ? 'twilight' : 'github';
|
||||
|
||||
export function getEditor(): ace.Editor {
|
||||
@@ -86,7 +90,10 @@
|
||||
$: watchOptions(options);
|
||||
function watchOptions(newOption: any) {
|
||||
if (editor) {
|
||||
editor.setOptions(newOption);
|
||||
editor.setOptions({
|
||||
...stdOptions,
|
||||
newOption,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +131,10 @@
|
||||
contentBackup = value;
|
||||
setEventCallBacks();
|
||||
if (options) {
|
||||
editor.setOptions(options);
|
||||
editor.setOptions({
|
||||
...stdOptions,
|
||||
options,
|
||||
});
|
||||
}
|
||||
|
||||
editor.container.addEventListener('contextmenu', handleContextMenu);
|
||||
@@ -141,16 +151,17 @@
|
||||
});
|
||||
|
||||
function setEventCallBacks() {
|
||||
editor.onBlur = () => dispatch('blur');
|
||||
editor.onChangeMode = obj => dispatch('changeMode', obj);
|
||||
editor.onCommandKey = (err, hashId, keyCode) => dispatch('commandKey', { err, hashId, keyCode });
|
||||
editor.onCopy = () => dispatch('copy');
|
||||
editor.onCursorChange = () => dispatch('cursorChange');
|
||||
editor.onCut = () => dispatch('cut');
|
||||
editor.onDocumentChange = (obj: { data: any }) => dispatch('documentChange', obj);
|
||||
editor.onFocus = () => dispatch('focus');
|
||||
editor.onPaste = text => dispatch('paste', text);
|
||||
editor.onSelectionChange = obj => dispatch('selectionChange', obj);
|
||||
// editor.onBlur = () => dispatch('blur');
|
||||
// editor.onChangeMode = obj => dispatch('changeMode', obj);
|
||||
// editor.onCommandKey = (err, hashId, keyCode) => dispatch('commandKey', { err, hashId, keyCode });
|
||||
// editor.onCopy = () => dispatch('copy');
|
||||
// editor.onCursorChange = () => dispatch('cursorChange');
|
||||
// editor.onCut = () => dispatch('cut');
|
||||
// editor.onDocumentChange = (obj: { data: any }) => dispatch('documentChange', obj);
|
||||
// editor.onFocus = () => dispatch('focus');
|
||||
// editor.onPaste = text => dispatch('paste', text);
|
||||
// editor.onSelectionChange = obj => dispatch('selectionChange', obj);
|
||||
|
||||
editor.setReadOnly(readOnly);
|
||||
editor.on('change', function () {
|
||||
const content = editor.getValue();
|
||||
|
||||
Reference in New Issue
Block a user