fix: deleted image wrongfully caching
This commit is contained in:
1 parent
b3793d5dbb
commit
ff0854f331
19 files changed
+201
-87
No files matched your search
@@ -12,9 +12,7 @@ declare module '@tiptap/core' {
|
||||
}
|
||||
}
|
||||
|
||||
function currentIndentableNode(state: {
|
||||
selection: { $from: { parent: unknown } }
|
||||
}) {
|
||||
function currentIndentableNode(state: { selection: { $from: { parent: unknown } } }) {
|
||||
return state.selection.$from.parent as {
|
||||
type: { name: string }
|
||||
attrs: { indent?: number }
|
||||
@@ -30,8 +28,7 @@ export const ArticleIndent = Extension.create({
|
||||
attributes: {
|
||||
indent: {
|
||||
default: 0,
|
||||
parseHTML: (element) =>
|
||||
Number(element.getAttribute('data-indent')) || 0,
|
||||
parseHTML: (element) => Number(element.getAttribute('data-indent')) || 0,
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.indent) {
|
||||
return {}
|
||||
@@ -55,17 +52,10 @@ export const ArticleIndent = Extension.create({
|
||||
if (!INDENT_TYPES.includes(node.type.name)) {
|
||||
return false
|
||||
}
|
||||
const level = Math.min(
|
||||
INDENT_MAX,
|
||||
(node.attrs.indent ?? 0) + 1,
|
||||
)
|
||||
const level = Math.min(INDENT_MAX, (node.attrs.indent ?? 0) + 1)
|
||||
if (dispatch) {
|
||||
const { $from } = state.selection
|
||||
tr.setNodeAttribute(
|
||||
$from.before($from.depth),
|
||||
'indent',
|
||||
level,
|
||||
)
|
||||
tr.setNodeAttribute($from.before($from.depth), 'indent', level)
|
||||
dispatch(tr)
|
||||
}
|
||||
return true
|
||||
@@ -83,11 +73,7 @@ export const ArticleIndent = Extension.create({
|
||||
const level = Math.max(0, (node.attrs.indent ?? 0) - 1)
|
||||
if (dispatch) {
|
||||
const { $from } = state.selection
|
||||
tr.setNodeAttribute(
|
||||
$from.before($from.depth),
|
||||
'indent',
|
||||
level,
|
||||
)
|
||||
tr.setNodeAttribute($from.before($from.depth), 'indent', level)
|
||||
dispatch(tr)
|
||||
}
|
||||
return true
|
||||
|
||||
Reference in new issue
Block a user