File tree Expand file tree Collapse file tree 4 files changed +14
-15
lines changed
src/extensions/yfm/YfmCut Expand file tree Collapse file tree 4 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 1+ import { nodeTypeFactory } from '../../../../utils/schema' ;
2+
13export enum CutNode {
24 Cut = 'yfm_cut' ,
35 CutTitle = 'yfm_cut_title' ,
46 CutContent = 'yfm_cut_content' ,
57}
8+
9+ export const cutType = nodeTypeFactory ( CutNode . Cut ) ;
10+ export const cutTitleType = nodeTypeFactory ( CutNode . CutTitle ) ;
11+ export const cutContentType = nodeTypeFactory ( CutNode . CutContent ) ;
Original file line number Diff line number Diff line change @@ -3,17 +3,13 @@ import yfmPlugin from '@diplodoc/transform/lib/plugins/cut';
33import type { NodeSpec } from 'prosemirror-model' ;
44
55import type { ExtensionAuto , YENodeSpec } from '../../../../core' ;
6- import { nodeTypeFactory } from '../../../../utils/schema' ;
76
87import { CutNode } from './const' ;
98import { fromYfm } from './fromYfm' ;
109import { getSpec } from './spec' ;
1110import { toYfm } from './toYfm' ;
1211
13- export { CutNode } from './const' ;
14- export const cutType = nodeTypeFactory ( CutNode . Cut ) ;
15- export const cutTitleType = nodeTypeFactory ( CutNode . CutTitle ) ;
16- export const cutContentType = nodeTypeFactory ( CutNode . CutContent ) ;
12+ export { CutNode , cutType , cutTitleType , cutContentType } from './const' ;
1713
1814export type YfmCutSpecsOptions = {
1915 cutView ?: YENodeSpec [ 'view' ] ;
Original file line number Diff line number Diff line change 11import type { NodeSpec } from 'prosemirror-model' ;
22
3- import { PlaceholderOptions } from '../../../../utils/placeholder' ;
3+ import type { PlaceholderOptions } from '../../../../utils/placeholder' ;
44import { CutNode } from '../const' ;
55
66import type { YfmCutSpecsOptions } from './index' ;
@@ -43,6 +43,7 @@ export const getSpec = (
4343 DEFAULT_PLACEHOLDERS . Title ,
4444 alwaysVisible : true ,
4545 } ,
46+ definingAsContext : true ,
4647 selectable : false ,
4748 allowSelection : false ,
4849 complex : 'leaf' ,
@@ -63,6 +64,7 @@ export const getSpec = (
6364 DEFAULT_PLACEHOLDERS . Content ,
6465 alwaysVisible : true ,
6566 } ,
67+ definingAsContext : true ,
6668 selectable : false ,
6769 allowSelection : false ,
6870 complex : 'leaf' ,
Original file line number Diff line number Diff line change @@ -3,17 +3,12 @@ import type {Command} from 'prosemirror-state';
33import { findParentNodeOfType } from 'prosemirror-utils' ;
44
55import type { ActionSpec } from '../../../../core' ;
6- import { nodeTypeFactory } from '../../../../utils/schema' ;
7- import { CutNode } from '../const' ;
8-
9- const yfmCutType = nodeTypeFactory ( CutNode . Cut ) ;
10- const yfmCutTitleType = nodeTypeFactory ( CutNode . CutTitle ) ;
11- const yfmCutContentType = nodeTypeFactory ( CutNode . CutContent ) ;
6+ import { cutContentType , cutTitleType , cutType } from '../const' ;
127
138const createYfmCutNode = ( schema : Schema ) => ( content ?: Node | Node [ ] ) => {
14- return yfmCutType ( schema ) . create ( null , [
15- yfmCutTitleType ( schema ) . create ( null ) ,
16- yfmCutContentType ( schema ) . create ( null , content ) ,
9+ return cutType ( schema ) . create ( null , [
10+ cutTitleType ( schema ) . create ( null ) ,
11+ cutContentType ( schema ) . create ( null , content ) ,
1712 ] ) ;
1813} ;
1914
You can’t perform that action at this time.
0 commit comments