mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
bf45e97641
* Update types * fix circular dep * type imports * lint type imports and --fix
21 lines
486 B
TypeScript
21 lines
486 B
TypeScript
import type { Attrs, MarkType } from "prosemirror-model";
|
|
import type { 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;
|
|
};
|