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