feat(insights): fix DBSCAN, Persian embeddings crash, D3 physics layouts, and D3 node not found runtime error
This commit is contained in:
58
memento-note/components/tiptap-clip-article-extension.ts
Normal file
58
memento-note/components/tiptap-clip-article-extension.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Node, mergeAttributes } from '@tiptap/core'
|
||||
|
||||
/** Conteneur RTL pour articles clippés — préserve direction héritée (listes, paragraphes). */
|
||||
export const ClipArticleExtension = Node.create({
|
||||
name: 'clipArticle',
|
||||
group: 'block',
|
||||
content: '(block | bulletList | orderedList)+',
|
||||
defining: true,
|
||||
|
||||
addAttributes() {
|
||||
return {
|
||||
dir: {
|
||||
default: 'rtl',
|
||||
parseHTML: (element) => element.getAttribute('dir') || 'rtl',
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.dir) return { dir: 'rtl' }
|
||||
return { dir: attributes.dir }
|
||||
},
|
||||
},
|
||||
lang: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute('lang'),
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.lang) return {}
|
||||
return { lang: attributes.lang }
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
parseHTML() {
|
||||
return [
|
||||
{
|
||||
tag: 'div.clip-article--rtl',
|
||||
priority: 60,
|
||||
},
|
||||
{
|
||||
tag: 'div.clip-article[dir="rtl"]',
|
||||
priority: 55,
|
||||
},
|
||||
{
|
||||
tag: 'div[dir="rtl"][class*="clip-article"]',
|
||||
priority: 50,
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return [
|
||||
'div',
|
||||
mergeAttributes(HTMLAttributes, {
|
||||
class: 'clip-article clip-article--rtl',
|
||||
dir: 'rtl',
|
||||
}),
|
||||
0,
|
||||
]
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user