Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions packages/core/src/editor/managers/ExtensionManager/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
AnyExtension as AnyTiptapExtension,
extensions,
getAttributes,
mergeAttributes,
Node,
Extension as TiptapExtension,
} from "@tiptap/core";
Expand Down Expand Up @@ -117,7 +118,13 @@ export function getDefaultTiptapExtensions(

let link: HTMLAnchorElement | null = null;

if (event.target instanceof HTMLAnchorElement) {
if (
event.target instanceof HTMLAnchorElement &&
// Differentiate between link inline content and read-only links.
event.target.hasAttribute("data-inline-content-type") &&
event.target.getAttribute("data-inline-content-type") ===
"link"
) {
link = event.target;
} else {
const target = event.target as HTMLElement | null;
Expand All @@ -128,8 +135,10 @@ export function getDefaultTiptapExtensions(
const root = tiptapEditor.view.dom;

// Intentionally limit the lookup to the editor root.
// Using tag names like DIV as boundaries breaks with custom NodeViews.
link = target.closest<HTMLAnchorElement>("a");
// Using tag names like DIV as boundaries breaks with custom NodeViews,
link = target.closest<HTMLAnchorElement>(
'a[data-inline-content-type="link"]',
);

if (link && !root.contains(link)) {
link = null;
Expand Down Expand Up @@ -178,7 +187,13 @@ export function getDefaultTiptapExtensions(
defaultProtocol: DEFAULT_LINK_PROTOCOL,
// only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
protocols: LINKIFY_INITIALIZED ? [] : VALID_LINK_PROTOCOLS,
HTMLAttributes: options.links?.HTMLAttributes ?? {},
HTMLAttributes: mergeAttributes(
{
className: "bn-inline-content-section",
"data-inline-content-type": "link",
},
options.links?.HTMLAttributes ?? {},
),
// Always false as we handle clicks ourselves above.
openOnClick: false,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ const UniqueID = Extension.create({
attributeName: "id",
types: [],
setIdAttribute: false,
isWithinEditor: undefined as
| ((element: Element) => boolean)
| undefined,
isWithinEditor: undefined as ((element: Element) => boolean) | undefined,
generateID: () => {
// Use mock ID if tests are running.
if (typeof window !== "undefined" && (window as any).__TEST_OPTIONS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const template = (project: Project) => ({
: {}),
"@types/react": "^19.2.3",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^4.7.0",
vite: "^5.4.20",
"@vitejs/plugin-react": "^6.0.1",
vite: "^8.0.3",
...(project.config?.devDependencies || {}),
},
});
Expand Down
4 changes: 2 additions & 2 deletions packages/xl-docx-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@blocknote/core": "0.48.1",
"@blocknote/xl-multi-column": "0.48.1",
"buffer": "^6.0.3",
"docx": "^9.5.1",
"docx": "^9.6.1",
"image-meta": "^0.2.2"
},
"devDependencies": {
Expand All @@ -72,7 +72,7 @@
"react-dom": "^19.2.5",
"rollup-plugin-webpack-stats": "^0.2.6",
"typescript": "^5.9.3",
"vite": "^8.0.3",
"vite": "^8.0.8",
"vite-plugin-eslint": "^1.8.1",
"vitest": "^4.1.2",
"xml-formatter": "^3.6.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
</pic:cNvPicPr>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId6" cstate="none"/>
<a:blip r:embed="rId7" cstate="none"/>
<a:srcRect/>
<a:stretch>
<a:fillRect/>
Expand Down Expand Up @@ -439,7 +439,7 @@
</pic:cNvPicPr>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId6" cstate="none"/>
<a:blip r:embed="rId7" cstate="none"/>
<a:srcRect/>
<a:stretch>
<a:fillRect/>
Expand Down
175 changes: 175 additions & 0 deletions packages/xl-docx-exporter/src/docx/__snapshots__/basic/styles.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,180 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:styles xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du">
<w:docDefaults>
<w:rPrDefault/>
<w:pPrDefault/>
</w:docDefaults>
<w:style w:type="paragraph" w:styleId="Title">
<w:name w:val="Title"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:sz w:val="56"/>
<w:szCs w:val="56"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading1">
<w:name w:val="Heading 1"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:color w:val="2E74B5"/>
<w:sz w:val="32"/>
<w:szCs w:val="32"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading2">
<w:name w:val="Heading 2"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:color w:val="2E74B5"/>
<w:sz w:val="26"/>
<w:szCs w:val="26"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading3">
<w:name w:val="Heading 3"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:color w:val="1F4D78"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading4">
<w:name w:val="Heading 4"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:i/>
<w:iCs/>
<w:color w:val="2E74B5"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading5">
<w:name w:val="Heading 5"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:color w:val="2E74B5"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading6">
<w:name w:val="Heading 6"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:color w:val="1F4D78"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="Strong">
<w:name w:val="Strong"/>
<w:basedOn w:val="Normal"/>
<w:next w:val="Normal"/>
<w:qFormat/>
<w:rPr>
<w:b/>
<w:bCs/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="ListParagraph">
<w:name w:val="List Paragraph"/>
<w:basedOn w:val="Normal"/>
<w:qFormat/>
</w:style>
<w:style w:type="character" w:styleId="Hyperlink">
<w:name w:val="Hyperlink"/>
<w:basedOn w:val="DefaultParagraphFont"/>
<w:uiPriority w:val="99"/>
<w:unhideWhenUsed/>
<w:rPr>
<w:color w:val="0563C1"/>
<w:u w:val="single"/>
</w:rPr>
</w:style>
<w:style w:type="character" w:styleId="FootnoteReference">
<w:name w:val="footnote reference"/>
<w:basedOn w:val="DefaultParagraphFont"/>
<w:uiPriority w:val="99"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
<w:rPr>
<w:vertAlign w:val="superscript"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="FootnoteText">
<w:name w:val="footnote text"/>
<w:basedOn w:val="Normal"/>
<w:link w:val="FootnoteTextChar"/>
<w:uiPriority w:val="99"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
<w:pPr>
<w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
</w:pPr>
<w:rPr>
<w:sz w:val="20"/>
<w:szCs w:val="20"/>
</w:rPr>
</w:style>
<w:style w:type="character" w:styleId="FootnoteTextChar">
<w:name w:val="Footnote Text Char"/>
<w:basedOn w:val="DefaultParagraphFont"/>
<w:link w:val="FootnoteText"/>
<w:uiPriority w:val="99"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
<w:rPr>
<w:sz w:val="20"/>
<w:szCs w:val="20"/>
</w:rPr>
</w:style>
<w:style w:type="character" w:styleId="EndnoteReference">
<w:name w:val="endnote reference"/>
<w:basedOn w:val="DefaultParagraphFont"/>
<w:uiPriority w:val="99"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
<w:rPr>
<w:vertAlign w:val="superscript"/>
</w:rPr>
</w:style>
<w:style w:type="paragraph" w:styleId="EndnoteText">
<w:name w:val="endnote text"/>
<w:basedOn w:val="Normal"/>
<w:link w:val="EndnoteTextChar"/>
<w:uiPriority w:val="99"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
<w:pPr>
<w:spacing w:after="0" w:line="240" w:lineRule="auto"/>
</w:pPr>
<w:rPr>
<w:sz w:val="20"/>
<w:szCs w:val="20"/>
</w:rPr>
</w:style>
<w:style w:type="character" w:styleId="EndnoteTextChar">
<w:name w:val="Endnote Text Char"/>
<w:basedOn w:val="DefaultParagraphFont"/>
<w:link w:val="EndnoteText"/>
<w:uiPriority w:val="99"/>
<w:semiHidden/>
<w:unhideWhenUsed/>
<w:rPr>
<w:sz w:val="20"/>
<w:szCs w:val="20"/>
</w:rPr>
</w:style>
<w:docDefaults>
<w:rPrDefault>
<w:rPr>
Expand Down
Loading
Loading