Browse Source

配置优化

mxd 3 năm trước cách đây
mục cha
commit
266f0bbf06

+ 1 - 1
src/components/common/magic-monaco-diff-editor.vue

@@ -31,7 +31,7 @@ export default {
 			fixedOverflowWidgets: false,
 			fontFamily: constants.EDITOR_FONT_FAMILY,
 			fontSize: constants.EDITOR_FONT_SIZE,
-			fontLigatures: true,
+			fontLigatures: constants.FONT_LIGATURES,
 			renderWhitespace: 'none',
 			theme: constants.THEME,
 			readOnly: this.readonly === true,

+ 1 - 1
src/components/common/magic-monaco-editor.vue

@@ -38,7 +38,7 @@ export default {
 			wordWrap: 'on',
 			fontFamily: constants.EDITOR_FONT_FAMILY,
 			fontSize: constants.EDITOR_FONT_SIZE,
-			fontLigatures: true,
+			fontLigatures: constants.FONT_LIGATURES,
 			renderWhitespace: 'none',
 			theme: constants.THEME,
 			readOnly: this.readonly === true,

+ 13 - 0
src/components/magic-editor.vue

@@ -252,6 +252,19 @@ constants.THEME = config.theme || 'default'
 constants.DEFAULT_EXPAND = config.defaultExpand !== false
 constants.JDBC_DRIVERS = config.jdbcDrivers || constants.JDBC_DRIVERS
 constants.DATASOURCE_TYPES = config.datasourceTypes || constants.DATASOURCE_TYPES
+if(config.editorFontFamily !== undefined){
+	constants.EDITOR_FONT_FAMILY = config.editorFontFamily
+}
+if(config.editorFontSize !== undefined){
+	constants.EDITOR_FONT_SIZE = config.editorFontSize
+}
+constants.FONT_LIGATURES = config.fontLigatures !== false
+if(config.logMaxRows !== undefined){
+	constants.LOG_MAX_ROWS = Math.max(config.logMaxRows, 10)
+}
+if(config.decorationTimeout !== undefined) {
+	constants.DECORATION_TIMEOUT = config.decorationTimeout
+}
 bus.$on(Message.MESSAGE, (msgType, content) => {
 	if(websocket){
 		if(content){

+ 4 - 0
src/components/panel/footer/magic-log.vue

@@ -17,6 +17,7 @@ import { getCurrentInstance, nextTick, onMounted, ref } from 'vue'
 import bus from '../../../scripts/bus.js'
 import $i from '../../../scripts/i18n.js'
 import Socket from '../../../scripts/constants/socket.js'
+import constants from '../../../scripts/constants.js'
 const logs = ref([])
 const keepScroll = ref(false)
 const toolbars = ref([{
@@ -90,6 +91,9 @@ const _pushLog = items => {
 	})
 	if(messages){
 		logs.value.push(...messages)
+		if(constants.LOG_MAX_ROWS !== Infinity && logs.value.length > constants.LOG_MAX_ROWS){
+			logs.value.splice(0, logs.value.length - constants.LOG_MAX_ROWS)
+		}
 		updateScroll()
 	}
 }

+ 1 - 0
src/scripts/constants.js

@@ -61,6 +61,7 @@ const constants = {
 		OPTIONS: [],
 		EDITOR_FONT_FAMILY: 'JetBrainsMono, Consolas, "Courier New",monospace, 微软雅黑',
 		EDITOR_FONT_SIZE: 14,
+		FONT_LIGATURES: true,
 		VALIDATE_TYPES: [
 			{ value: 'pass', text: $i('message.noValidate')},
 			{ value: 'expression', text: $i('message.validateExpression')},