mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-05-18 05:05:36 +02:00
editor: export & use AttributeUpdate interface
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,7 @@ import { Step, StepResult } from "@tiptap/pm/transform";
|
|||||||
import { Node, Schema, Fragment } from "@tiptap/pm/model";
|
import { Node, Schema, Fragment } from "@tiptap/pm/model";
|
||||||
import { Mapping } from "@tiptap/pm/transform";
|
import { Mapping } from "@tiptap/pm/transform";
|
||||||
|
|
||||||
interface AttributeUpdate {
|
export interface AttributeUpdate {
|
||||||
pos: number;
|
pos: number;
|
||||||
attrName: string;
|
attrName: string;
|
||||||
value: any;
|
value: any;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
changedDescendants,
|
changedDescendants,
|
||||||
findParentNodeOfTypeClosestToPos
|
findParentNodeOfTypeClosestToPos
|
||||||
} from "../../utils/prosemirror.js";
|
} from "../../utils/prosemirror.js";
|
||||||
import { BatchAttributeStep } from "./batch-attribute-step.js";
|
import { AttributeUpdate, BatchAttributeStep } from "./batch-attribute-step.js";
|
||||||
|
|
||||||
const COLLAPSIBLE_BLOCK_TYPES = [
|
const COLLAPSIBLE_BLOCK_TYPES = [
|
||||||
"paragraph",
|
"paragraph",
|
||||||
@@ -318,7 +318,7 @@ function toggleNodesUnderPos(
|
|||||||
let shouldMoveCursor = false;
|
let shouldMoveCursor = false;
|
||||||
let insideCollapsedHeading = false;
|
let insideCollapsedHeading = false;
|
||||||
let nestedHeadingLevel: number | null = null;
|
let nestedHeadingLevel: number | null = null;
|
||||||
const updates: { pos: number; attrName: string; value: any }[] = [];
|
const updates: AttributeUpdate[] = [];
|
||||||
|
|
||||||
while (nextPos < doc.content.size) {
|
while (nextPos < doc.content.size) {
|
||||||
const nextNode = doc.nodeAt(nextPos);
|
const nextNode = doc.nodeAt(nextPos);
|
||||||
|
|||||||
Reference in New Issue
Block a user