feat(insights): fix DBSCAN, Persian embeddings crash, D3 physics layouts, and D3 node not found runtime error
This commit is contained in:
46
memento-note/components/tiptap-rtl-preserve-extension.ts
Normal file
46
memento-note/components/tiptap-rtl-preserve-extension.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Extension } from '@tiptap/core'
|
||||
|
||||
/** Préserve dir/lang sur les blocs HTML (contenus clippés persan/arabe). */
|
||||
export const RtlPreserveExtension = Extension.create({
|
||||
name: 'rtlPreserve',
|
||||
addGlobalAttributes() {
|
||||
return [
|
||||
{
|
||||
types: [
|
||||
'paragraph',
|
||||
'heading',
|
||||
'blockquote',
|
||||
'listItem',
|
||||
'bulletList',
|
||||
'orderedList',
|
||||
],
|
||||
attributes: {
|
||||
dir: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute('dir'),
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.dir) return {}
|
||||
return { dir: attributes.dir }
|
||||
},
|
||||
},
|
||||
lang: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute('lang'),
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.lang) return {}
|
||||
return { lang: attributes.lang }
|
||||
},
|
||||
},
|
||||
class: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute('class'),
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.class) return {}
|
||||
return { class: attributes.class }
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user