mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 00:01:19 +08:00
Feat: add user preference whether hide the link popup (#1504)
This commit is contained in:
parent
d0d76f0b5d
commit
a4b4a7a847
@ -19,23 +19,24 @@ Preferences can be controlled and modified in the settings window or via the `pr
|
|||||||
|
|
||||||
#### Editor
|
#### Editor
|
||||||
|
|
||||||
| Key | Type | Defaut | Description |
|
| Key | Type | Defaut | Description |
|
||||||
| ---------------------- | ------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ---------------------------------- | ------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| fontSize | Number | 16 | Font size in pixels. 12 ~ 32 |
|
| fontSize | Number | 16 | Font size in pixels. 12 ~ 32 |
|
||||||
| editorFontFamily | String | Open Sans | Font Family |
|
| editorFontFamily | String | Open Sans | Font Family |
|
||||||
| lineHeight | Number | 1.6 | Line Height |
|
| lineHeight | Number | 1.6 | Line Height |
|
||||||
| autoPairBracket | Boolean | true | Automatically brackets when editing |
|
| autoPairBracket | Boolean | true | Automatically brackets when editing |
|
||||||
| autoPairMarkdownSyntax | Boolean | true | Autocomplete markdown syntax |
|
| autoPairMarkdownSyntax | Boolean | true | Autocomplete markdown syntax |
|
||||||
| autoPairQuote | Boolean | true | Automatic completion of quotes |
|
| autoPairQuote | Boolean | true | Automatic completion of quotes |
|
||||||
| endOfLine | String | default | The newline character used at the end of each line. The default value is default, which will be selected according to your system intelligence. `lf` `crlf` `default` |
|
| endOfLine | String | default | The newline character used at the end of each line. The default value is default, which will be selected according to your system intelligence. `lf` `crlf` `default` |
|
||||||
| textDirection | String | ltr | The writing text direction, optional value: `ltr` or `rtl` |
|
| textDirection | String | ltr | The writing text direction, optional value: `ltr` or `rtl` |
|
||||||
| codeFontSize | Number | 14 | Font size on code block, the range is 12 ~ 28 |
|
| codeFontSize | Number | 14 | Font size on code block, the range is 12 ~ 28 |
|
||||||
| codeFontFamily | String | `DejaVu Sans Mono` | Code font family |
|
| codeFontFamily | String | `DejaVu Sans Mono` | Code font family |
|
||||||
| trimUnnecessaryCodeBlockEmptyLines | Boolean | true | Whether to trim the beginning and end empty line in Code block |
|
| trimUnnecessaryCodeBlockEmptyLines | Boolean | true | Whether to trim the beginning and end empty line in Code block |
|
||||||
| hideQuickInsertHint | Boolean | false | Hide hint for quickly creating paragraphs |
|
| hideQuickInsertHint | Boolean | false | Hide hint for quickly creating paragraphs |
|
||||||
| imageDropAction | String | folder | The default behavior after paste or drag the image to Mark Text, upload it to the image cloud (if configured), move to the specified folder, insert the path |
|
| imageDropAction | String | folder | The default behavior after paste or drag the image to Mark Text, upload it to the image cloud (if configured), move to the specified folder, insert the path |
|
||||||
| defaultEncoding | String | `utf8` | The default file encoding |
|
| defaultEncoding | String | `utf8` | The default file encoding |
|
||||||
| autoGuessEncoding | Boolean | true | Try to automatically guess the file encoding when opening files |
|
| autoGuessEncoding | Boolean | true | Try to automatically guess the file encoding when opening files |
|
||||||
|
| hideLinkPopup | Boolean | false | It will not show the link popup when hover over the link if set `hideLinkPopup` to true |
|
||||||
|
|
||||||
#### Markdown
|
#### Markdown
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ Preferences can be controlled and modified in the settings window or via the `pr
|
|||||||
| tabSize | Number | 4 | The number of spaces a tab is equal to |
|
| tabSize | Number | 4 | The number of spaces a tab is equal to |
|
||||||
| listIndentation | String | 1 | The list indentation of sub list items or paragraphs, optional value `dfm`, `tab` or number 1~4 |
|
| listIndentation | String | 1 | The list indentation of sub list items or paragraphs, optional value `dfm`, `tab` or number 1~4 |
|
||||||
| frontmatterType | String | `-` | The frontmatter type: `-` (YAML), `+` (TOML), `;` (JSON) or `{` (JSON) |
|
| frontmatterType | String | `-` | The frontmatter type: `-` (YAML), `+` (TOML), `;` (JSON) or `{` (JSON) |
|
||||||
|
|
||||||
#### Theme
|
#### Theme
|
||||||
|
|
||||||
| Key | Type | Default | Description |
|
| Key | Type | Default | Description |
|
||||||
|
@ -176,6 +176,11 @@
|
|||||||
"description": "Editor--Hide hint for quickly creating paragraphs",
|
"description": "Editor--Hide hint for quickly creating paragraphs",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"hideLinkPopup": {
|
||||||
|
"description": "Editor--Hide link popup when the cursor is hover on the link",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
|
|
||||||
"preferLooseListItem": {
|
"preferLooseListItem": {
|
||||||
"description": "Markdown--The preferred list type",
|
"description": "Markdown--The preferred list type",
|
||||||
|
@ -255,6 +255,7 @@ export const MUYA_DEFAULT_OPTION = {
|
|||||||
mermaidTheme: 'default', // dark / forest / default
|
mermaidTheme: 'default', // dark / forest / default
|
||||||
vegaTheme: 'latimes', // excel / ggplot2 / quartz / vox / fivethirtyeight / dark / latimes
|
vegaTheme: 'latimes', // excel / ggplot2 / quartz / vox / fivethirtyeight / dark / latimes
|
||||||
hideQuickInsertHint: false,
|
hideQuickInsertHint: false,
|
||||||
|
hideLinkPopup: false,
|
||||||
// Whether we should set spellcheck attribute on our container to highlight misspelled words.
|
// Whether we should set spellcheck attribute on our container to highlight misspelled words.
|
||||||
// NOTE: The browser is not able to correct misspelled words words without a custom
|
// NOTE: The browser is not able to correct misspelled words words without a custom
|
||||||
// implementation like in Mark Text.
|
// implementation like in Mark Text.
|
||||||
|
@ -12,7 +12,8 @@ class MouseEvent {
|
|||||||
const handler = event => {
|
const handler = event => {
|
||||||
const target = event.target
|
const target = event.target
|
||||||
const parent = target.parentNode
|
const parent = target.parentNode
|
||||||
if (parent && parent.tagName === 'A' && parent.classList.contains('ag-inline-rule')) {
|
const { hideLinkPopup } = this.muya.options
|
||||||
|
if (!hideLinkPopup && parent && parent.tagName === 'A' && parent.classList.contains('ag-inline-rule')) {
|
||||||
const rect = parent.getBoundingClientRect()
|
const rect = parent.getBoundingClientRect()
|
||||||
const reference = {
|
const reference = {
|
||||||
getBoundingClientRect () {
|
getBoundingClientRect () {
|
||||||
|
@ -144,6 +144,7 @@ export default {
|
|||||||
trimUnnecessaryCodeBlockEmptyLines: state => state.preferences.trimUnnecessaryCodeBlockEmptyLines,
|
trimUnnecessaryCodeBlockEmptyLines: state => state.preferences.trimUnnecessaryCodeBlockEmptyLines,
|
||||||
editorFontFamily: state => state.preferences.editorFontFamily,
|
editorFontFamily: state => state.preferences.editorFontFamily,
|
||||||
hideQuickInsertHint: state => state.preferences.hideQuickInsertHint,
|
hideQuickInsertHint: state => state.preferences.hideQuickInsertHint,
|
||||||
|
hideLinkPopup: state => state.preferences.hideLinkPopup,
|
||||||
editorLineWidth: state => state.preferences.editorLineWidth,
|
editorLineWidth: state => state.preferences.editorLineWidth,
|
||||||
imageInsertAction: state => state.preferences.imageInsertAction,
|
imageInsertAction: state => state.preferences.imageInsertAction,
|
||||||
imageFolderPath: state => state.preferences.imageFolderPath,
|
imageFolderPath: state => state.preferences.imageFolderPath,
|
||||||
@ -291,6 +292,12 @@ export default {
|
|||||||
editor.setOptions({ orderListDelimiter: value })
|
editor.setOptions({ orderListDelimiter: value })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
hideLinkPopup: function (value, oldValue) {
|
||||||
|
const { editor } = this
|
||||||
|
if (value !== oldValue && editor) {
|
||||||
|
editor.setOptions({ hideLinkPopup: value })
|
||||||
|
}
|
||||||
|
},
|
||||||
codeFontSize: function (value, oldValue) {
|
codeFontSize: function (value, oldValue) {
|
||||||
if (value !== oldValue) {
|
if (value !== oldValue) {
|
||||||
addCommonStyle({
|
addCommonStyle({
|
||||||
@ -434,7 +441,8 @@ export default {
|
|||||||
hideQuickInsertHint,
|
hideQuickInsertHint,
|
||||||
editorLineWidth,
|
editorLineWidth,
|
||||||
theme,
|
theme,
|
||||||
spellcheckerEnabled
|
spellcheckerEnabled,
|
||||||
|
hideLinkPopup
|
||||||
} = this
|
} = this
|
||||||
|
|
||||||
// use muya UI plugins
|
// use muya UI plugins
|
||||||
@ -471,6 +479,7 @@ export default {
|
|||||||
listIndentation,
|
listIndentation,
|
||||||
frontmatterType,
|
frontmatterType,
|
||||||
hideQuickInsertHint,
|
hideQuickInsertHint,
|
||||||
|
hideLinkPopup,
|
||||||
spellcheckEnabled: spellcheckerEnabled,
|
spellcheckEnabled: spellcheckerEnabled,
|
||||||
imageAction: this.imageAction.bind(this),
|
imageAction: this.imageAction.bind(this),
|
||||||
imagePathPicker: this.imagePathPicker.bind(this),
|
imagePathPicker: this.imagePathPicker.bind(this),
|
||||||
|
@ -91,6 +91,11 @@
|
|||||||
:bool="hideQuickInsertHint"
|
:bool="hideQuickInsertHint"
|
||||||
:onChange="value => onSelectChange('hideQuickInsertHint', value)"
|
:onChange="value => onSelectChange('hideQuickInsertHint', value)"
|
||||||
></bool>
|
></bool>
|
||||||
|
<bool
|
||||||
|
description="Hide link popup when the cursor is hover on the link."
|
||||||
|
:bool="hideLinkPopup"
|
||||||
|
:onChange="value => onSelectChange('hideLinkPopup', value)"
|
||||||
|
></bool>
|
||||||
<separator></separator>
|
<separator></separator>
|
||||||
<text-box
|
<text-box
|
||||||
description="Defines the maximum editor area width. An empty string or suffixes of ch (characters), px (pixels) or % (percentage) are allowed."
|
description="Defines the maximum editor area width. An empty string or suffixes of ch (characters), px (pixels) or % (percentage) are allowed."
|
||||||
@ -145,6 +150,7 @@ export default {
|
|||||||
codeFontFamily: state => state.preferences.codeFontFamily,
|
codeFontFamily: state => state.preferences.codeFontFamily,
|
||||||
trimUnnecessaryCodeBlockEmptyLines: state => state.preferences.trimUnnecessaryCodeBlockEmptyLines,
|
trimUnnecessaryCodeBlockEmptyLines: state => state.preferences.trimUnnecessaryCodeBlockEmptyLines,
|
||||||
hideQuickInsertHint: state => state.preferences.hideQuickInsertHint,
|
hideQuickInsertHint: state => state.preferences.hideQuickInsertHint,
|
||||||
|
hideLinkPopup: state => state.preferences.hideLinkPopup,
|
||||||
editorLineWidth: state => state.preferences.editorLineWidth,
|
editorLineWidth: state => state.preferences.editorLineWidth,
|
||||||
defaultEncoding: state => state.preferences.defaultEncoding,
|
defaultEncoding: state => state.preferences.defaultEncoding,
|
||||||
autoGuessEncoding: state => state.preferences.autoGuessEncoding
|
autoGuessEncoding: state => state.preferences.autoGuessEncoding
|
||||||
|
@ -31,6 +31,7 @@ const state = {
|
|||||||
textDirection: 'ltr',
|
textDirection: 'ltr',
|
||||||
hideQuickInsertHint: false,
|
hideQuickInsertHint: false,
|
||||||
imageInsertAction: 'folder',
|
imageInsertAction: 'folder',
|
||||||
|
hideLinkPopup: false,
|
||||||
|
|
||||||
preferLooseListItem: true,
|
preferLooseListItem: true,
|
||||||
bulletListMarker: '-',
|
bulletListMarker: '-',
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"textDirection": "ltr",
|
"textDirection": "ltr",
|
||||||
"hideQuickInsertHint": false,
|
"hideQuickInsertHint": false,
|
||||||
"imageInsertAction": "path",
|
"imageInsertAction": "path",
|
||||||
|
"hideLinkPopup": false,
|
||||||
|
|
||||||
"preferLooseListItem": true,
|
"preferLooseListItem": true,
|
||||||
"bulletListMarker": "-",
|
"bulletListMarker": "-",
|
||||||
|
Loading…
Reference in New Issue
Block a user