feat: Comment resolving (#7115)
This commit is contained in:
20
shared/editor/commands/addMark.ts
Normal file
20
shared/editor/commands/addMark.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Attrs, MarkType } from "prosemirror-model";
|
||||
import { Command } from "prosemirror-state";
|
||||
|
||||
/**
|
||||
* A prosemirror command to create a mark at the current selection.
|
||||
*
|
||||
* @returns A prosemirror command.
|
||||
*/
|
||||
export const addMark =
|
||||
(type: MarkType, attrs?: Attrs | null): Command =>
|
||||
(state, dispatch) => {
|
||||
dispatch?.(
|
||||
state.tr.addMark(
|
||||
state.selection.from,
|
||||
state.selection.to,
|
||||
type.create(attrs)
|
||||
)
|
||||
);
|
||||
return true;
|
||||
};
|
||||
@@ -1,6 +1,11 @@
|
||||
import { Command, TextSelection } from "prosemirror-state";
|
||||
|
||||
const collapseSelection = (): Command => (state, dispatch) => {
|
||||
/**
|
||||
* A prosemirror command to collapse the current selection to a cursor at the start of the selection.
|
||||
*
|
||||
* @returns A prosemirror command.
|
||||
*/
|
||||
export const collapseSelection = (): Command => (state, dispatch) => {
|
||||
dispatch?.(
|
||||
state.tr.setSelection(
|
||||
TextSelection.create(state.doc, state.tr.selection.from)
|
||||
@@ -8,5 +13,3 @@ const collapseSelection = (): Command => (state, dispatch) => {
|
||||
);
|
||||
return true;
|
||||
};
|
||||
|
||||
export default collapseSelection;
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { chainTransactions } from "../lib/chainTransactions";
|
||||
import { getCellsInColumn, isHeaderEnabled } from "../queries/table";
|
||||
import { TableLayout } from "../types";
|
||||
import collapseSelection from "./collapseSelection";
|
||||
import { collapseSelection } from "./collapseSelection";
|
||||
|
||||
export function createTable({
|
||||
rowsCount,
|
||||
|
||||
Reference in New Issue
Block a user