mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 01:53:11 +08:00
handle backspace in footnote
This commit is contained in:
parent
ec91b31d49
commit
3f74a8809f
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
- languageInput
|
- languageInput
|
||||||
|
|
||||||
|
- footnoteInput
|
||||||
|
|
||||||
- codeContent (used in code block)
|
- codeContent (used in code block)
|
||||||
|
|
||||||
- cellContent (used in table cell, it's parent must be th or td block)
|
- cellContent (used in table cell, it's parent must be th or td block)
|
||||||
@ -46,6 +48,8 @@ The container block of `table`, `html`, `block math`, `mermaid`,`flowchart`,`veg
|
|||||||
|
|
||||||
- table
|
- table
|
||||||
|
|
||||||
|
- footnote
|
||||||
|
|
||||||
- html
|
- html
|
||||||
|
|
||||||
- multiplemath
|
- multiplemath
|
||||||
|
@ -183,12 +183,12 @@ figure[data-role="HTML"].ag-active .ag-html-preview {
|
|||||||
figure[data-role="FOOTNOTE"] {
|
figure[data-role="FOOTNOTE"] {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--footnoteBgColor);
|
background: var(--footnoteBgColor);
|
||||||
padding: 1em 1em .05em 1em;
|
padding: 1em 2em .05em 1em;
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
opacity: .8;
|
opacity: .8;
|
||||||
}
|
}
|
||||||
|
|
||||||
figure[data-role="FOOTNOTE"] .ag-paragraph-content:first-of-type:empty::after {
|
figure[data-role="FOOTNOTE"] > p:first-of-type .ag-paragraph-content:empty::after {
|
||||||
content: 'Input the footnote definition...';
|
content: 'Input the footnote definition...';
|
||||||
color: var(--editorColor30);
|
color: var(--editorColor30);
|
||||||
}
|
}
|
||||||
@ -1176,8 +1176,8 @@ i.ag-footnote-backlink {
|
|||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1em;
|
right: .5em;
|
||||||
bottom: .15em;
|
bottom: .5em;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
@ -345,6 +345,29 @@ const backspaceCtrl = ContentState => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
block.type === 'span' &&
|
||||||
|
block.functionType === 'paragraphContent' &&
|
||||||
|
left === 0 &&
|
||||||
|
preBlock &&
|
||||||
|
preBlock.functionType === 'footnoteInput'
|
||||||
|
) {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
if (!parent.nextSibling) {
|
||||||
|
const pBlock = this.createBlockP(block.text)
|
||||||
|
const figureBlock = this.closest(block, 'figure')
|
||||||
|
this.insertBefore(pBlock, figureBlock)
|
||||||
|
this.removeBlock(figureBlock)
|
||||||
|
const key = pBlock.children[0].key
|
||||||
|
const offset = 0
|
||||||
|
this.cursor = {
|
||||||
|
start: { key, offset },
|
||||||
|
end: { key, offset }
|
||||||
|
}
|
||||||
|
|
||||||
|
this.partialRender()
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
block.type === 'span' &&
|
block.type === 'span' &&
|
||||||
block.functionType === 'codeContent' &&
|
block.functionType === 'codeContent' &&
|
||||||
left === 0 &&
|
left === 0 &&
|
||||||
@ -492,7 +515,7 @@ const backspaceCtrl = ContentState => {
|
|||||||
// also need to remove the paragrah
|
// also need to remove the paragrah
|
||||||
if (this.isOnlyChild(block) && block.type === 'span') {
|
if (this.isOnlyChild(block) && block.type === 'span') {
|
||||||
this.removeBlock(parent)
|
this.removeBlock(parent)
|
||||||
} else if (block.functionType !== 'languageInput') {
|
} else if (block.functionType !== 'languageInput' && block.functionType !== 'footnoteInput') {
|
||||||
this.removeBlock(block)
|
this.removeBlock(block)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user