[Editor] Support selection (#451)

This commit is contained in:
qianmoQ 2023-10-20 07:32:46 -05:00 committed by GitHub
commit 218c2cc1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 90 additions and 72 deletions

1
.gitignore vendored
View File

@ -51,3 +51,4 @@ shaded/*/dependency-reduced-pom.xml
# datacap #
cache/
config/
docs/site/

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -1,7 +1,7 @@
{
"name": "datacap-console",
"description": "DataCap console",
"version": "1.15.0",
"version": "1.16.0-SNAPSHOT",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",

View File

@ -32,6 +32,7 @@ export default {
state: 'State',
elapsed: 'Elapsed',
run: 'Run',
runSelection: 'Run Selection',
cancel: 'Cancel',
format: 'Format',
snippet: 'Snippet',

View File

@ -32,6 +32,7 @@ export default {
state: '状态',
elapsed: '消耗',
run: '运行',
runSelection: '运行选择内容',
cancel: '取消',
format: '格式化',
snippet: '片段',

View File

@ -25,7 +25,7 @@
:loading="tableLoading"
:disabled="!applySource"
@click="handlerRun()">
{{ $t('common.run') }}
{{ buttonRunText }}
</Button>
<Button type="dashed"
size="small"
@ -218,7 +218,9 @@ export default defineComponent({
visibleAiHelp: false,
engine: null,
aiSupportType: ['ANALYSIS', 'OPTIMIZE'],
error: null
error: null,
buttonRunText: null,
isSelection: false
}
},
created()
@ -228,6 +230,7 @@ export default defineComponent({
methods: {
handlerInitialize()
{
this.buttonRunText = this.i18n.t('common.run');
const defaultEditor: EditorInstance = {
title: 'New Query',
key: Date.now().toString()
@ -264,12 +267,24 @@ export default defineComponent({
handlerInitializeCompleter(editor: Editor, language: string)
{
try {
// The configuration editor selects content events
editor.selection.on('changeSelection', () => {
const selection = editor.getSelection();
if (selection.isEmpty()) {
this.buttonRunText = this.i18n.t('common.run');
this.isSelection = false;
}
else {
this.buttonRunText = this.i18n.t('common.runSelection');
this.isSelection = true;
}
})
langTools.addCompleter({
getCompletions: function (editor, session, pos, prefix, callback) {
return callback(null, []);
}
});
// Clear default keywords and code snippets
editor.completers = [];
const that = this;
@ -339,7 +354,7 @@ export default defineComponent({
const editorInstance = this.editorMaps.get(this.activeKey);
const configure: ExecuteModel = {
name: this.applySource,
content: editorInstance.instance.getValue(),
content: this.isSelection ? editorInstance.instance.getSelectedText() : editorInstance.instance.getValue(),
format: "JSON"
};
new ExecuteService()

View File

@ -8,7 +8,7 @@ repo_url: https://github.com/devlive-community/datacap
edit_uri: "https://github.com/devlive-community/datacap/blob/dev/docs/docs"
banners:
- title: DataCap 1.14.0 is released
- title: DataCap 1.15.0 is released
link: /release-latest.html
description: <a href="https://github.com/devlive-community/datacap"> Do you ❤️ DataCap? Give us a 🌟 on GitHub </a>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>datacap</artifactId>
<groupId>io.edurt.datacap</groupId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<packaging>pom</packaging>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<modules>
<module>client/datacap-cli</module>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>io.edurt.datacap</groupId>
<artifactId>datacap</artifactId>
<version>1.15.0</version>
<version>1.16.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>