mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
45f10bf62a
commit
dbcd6df7f9
1 changed files with 3 additions and 2 deletions
|
|
@ -365,9 +365,10 @@ export class WYSIWYG {
|
||||||
const selectTypes = protyle.toolbar.getCurrentType(range);
|
const selectTypes = protyle.toolbar.getCurrentType(range);
|
||||||
const spanElement = hasClosestByTag(range.startContainer, "SPAN");
|
const spanElement = hasClosestByTag(range.startContainer, "SPAN");
|
||||||
const headingElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeHeading");
|
const headingElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeHeading");
|
||||||
|
const matchHeading = headingElement && headingElement.textContent.replace(Constants.ZWSP, "") === range.toString();
|
||||||
if ((selectTypes.length > 0 && spanElement && spanElement.textContent.replace(Constants.ZWSP, "") === range.toString()) ||
|
if ((selectTypes.length > 0 && spanElement && spanElement.textContent.replace(Constants.ZWSP, "") === range.toString()) ||
|
||||||
(headingElement && headingElement.textContent.replace(Constants.ZWSP, "") === range.toString())) {
|
matchHeading) {
|
||||||
if (headingElement) {
|
if (matchHeading) {
|
||||||
// 复制标题 https://github.com/siyuan-note/insider/issues/297
|
// 复制标题 https://github.com/siyuan-note/insider/issues/297
|
||||||
tempElement.append(headingElement.cloneNode(true));
|
tempElement.append(headingElement.cloneNode(true));
|
||||||
} else if (!["DIV", "TD", "TH", "TR"].includes(range.startContainer.parentElement.tagName)) {
|
} else if (!["DIV", "TD", "TH", "TR"].includes(range.startContainer.parentElement.tagName)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue