4
4
* extends the basic schemas provided by ProseMirror
5
5
*/
6
6
7
- import { schema as schemaBasic } from 'prosemirror-schema-basic' ;
8
- import { tableNodes } from 'prosemirror-tables' ;
9
- import { bulletList , listItem , orderedList } from 'prosemirror-schema-list' ;
7
+ import { schema as schemaBasic } from 'prosemirror-schema-basic' ;
8
+ import { tableNodes } from 'prosemirror-tables' ;
9
+ import { bulletList , listItem , orderedList } from 'prosemirror-schema-list' ;
10
10
11
11
export default function getSpec ( ) {
12
- let { nodes, marks} = schemaBasic . spec ;
12
+ let { nodes, marks } = schemaBasic . spec ;
13
13
14
14
const doc = nodes . get ( 'doc' ) ;
15
15
doc . content = '(block | baseonly | container | protected_block | substitution_block)+' ;
16
16
doc . attrs = {
17
- nocache : { default : false } ,
18
- notoc : { default : false } ,
17
+ nocache : { default : false } ,
18
+ notoc : { default : false } ,
19
19
} ;
20
20
nodes = nodes . update ( 'doc' , doc ) ;
21
21
@@ -58,7 +58,7 @@ export default function getSpec() {
58
58
59
59
const tableNode = nodes . get ( 'table' ) ;
60
60
tableNode . toDOM = function toDOM ( ) {
61
- return [ 'div' , { class : 'table' } , [ 'table' , { class : 'inline' } , [ 'tbody' , 0 ] ] ] ;
61
+ return [ 'div' , { class : 'table' } , [ 'table' , { class : 'inline' } , [ 'tbody' , 0 ] ] ] ;
62
62
} ;
63
63
nodes . update ( 'table' , tableNode ) ;
64
64
@@ -69,15 +69,15 @@ export default function getSpec() {
69
69
group : 'protected_block' ,
70
70
code : true ,
71
71
toDOM ( ) {
72
- return [ 'pre' , { class : 'code' } , 0 ] ;
72
+ return [ 'pre' , { class : 'code' } , 0 ] ;
73
73
} ,
74
74
} ) ;
75
75
76
76
const codeBlock = nodes . get ( 'code_block' ) ;
77
77
codeBlock . attrs = {
78
- class : { default : 'code' } ,
79
- 'data-filename' : { default : '' } ,
80
- 'data-language' : { default : '' } ,
78
+ class : { default : 'code' } ,
79
+ 'data-filename' : { default : '' } ,
80
+ 'data-language' : { default : '' } ,
81
81
} ;
82
82
codeBlock . toDOM = function toDOM ( node ) {
83
83
return [ 'pre' , node . attrs , 0 ] ;
@@ -88,16 +88,16 @@ export default function getSpec() {
88
88
const quote = nodes . get ( 'blockquote' ) ;
89
89
quote . content = '(block | blockquote | protected_block)+' ;
90
90
quote . group = 'container' ;
91
- quote . toDom = ( ) => [ 'blockquote' , { } , [ 'div' , { class : 'no' } , 0 ] ] ;
91
+ quote . toDom = ( ) => [ 'blockquote' , { } , [ 'div' , { class : 'no' } , 0 ] ] ;
92
92
nodes . update ( 'blockquote' , quote ) ;
93
93
94
94
const imageNode = nodes . get ( 'image' ) ;
95
- imageNode . attrs . width = { default : '' } ;
96
- imageNode . attrs . height = { default : '' } ;
97
- imageNode . attrs . align = { default : '' } ;
98
- imageNode . attrs . linking = { default : '' } ;
99
- imageNode . attrs . cache = { default : '' } ;
100
- imageNode . attrs [ 'data-resolvedHtml' ] = { default : '' } ;
95
+ imageNode . attrs . width = { default : '' } ;
96
+ imageNode . attrs . height = { default : '' } ;
97
+ imageNode . attrs . align = { default : '' } ;
98
+ imageNode . attrs . linking = { default : '' } ;
99
+ imageNode . attrs . cache = { default : '' } ;
100
+ imageNode . attrs [ 'data-resolvedHtml' ] = { default : '' } ;
101
101
imageNode . attrs . id = { } ;
102
102
delete imageNode . attrs . src ;
103
103
imageNode . parseDOM = [
@@ -162,7 +162,7 @@ export default function getSpec() {
162
162
163
163
const imageAttrs = { } ;
164
164
Object . keys ( imageNode . attrs ) . forEach ( ( key ) => {
165
- imageAttrs [ `image-${ key } ` ] = { default : null } ;
165
+ imageAttrs [ `image-${ key } ` ] = { default : null } ;
166
166
} ) ;
167
167
168
168
nodes = nodes . addToEnd ( 'link' , {
@@ -171,13 +171,13 @@ export default function getSpec() {
171
171
attrs : {
172
172
'data-type' : { } ,
173
173
'data-inner' : { } ,
174
- 'data-name' : { default : null } ,
175
- 'data-resolvedID' : { default : null } ,
176
- 'data-resolvedUrl' : { default : null } ,
177
- 'data-resolvedName' : { default : null } ,
178
- 'data-resolvedClass' : { default : null } ,
179
- 'data-resolvedTitle' : { default : null } ,
180
- 'data-resolvedImage' : { default : '' } ,
174
+ 'data-name' : { default : null } ,
175
+ 'data-resolvedID' : { default : null } ,
176
+ 'data-resolvedUrl' : { default : null } ,
177
+ 'data-resolvedName' : { default : null } ,
178
+ 'data-resolvedClass' : { default : null } ,
179
+ 'data-resolvedTitle' : { default : null } ,
180
+ 'data-resolvedImage' : { default : '' } ,
181
181
...imageAttrs ,
182
182
} ,
183
183
toDOM ( node ) {
@@ -189,7 +189,7 @@ export default function getSpec() {
189
189
content : '' ,
190
190
marks : '' ,
191
191
attrs : {
192
- contentJSON : { default : '' } ,
192
+ contentJSON : { default : '' } ,
193
193
} ,
194
194
group : 'inline' ,
195
195
inline : true ,
@@ -218,7 +218,7 @@ export default function getSpec() {
218
218
return false ;
219
219
}
220
220
const syntax = dom . getAttribute ( 'alt' ) ;
221
- return { icon, syntax} ;
221
+ return { icon, syntax } ;
222
222
} ,
223
223
} ] ,
224
224
} ) ;
@@ -227,24 +227,24 @@ export default function getSpec() {
227
227
group : 'substitution_block' ,
228
228
atom : true ,
229
229
attrs : {
230
- class : { default : 'rss' } ,
230
+ class : { default : 'rss' } ,
231
231
url : { } ,
232
- max : { default : 8 } ,
233
- reverse : { default : null } ,
234
- author : { default : null } ,
235
- date : { default : null } ,
236
- details : { default : null } ,
237
- refresh : { default : '' } ,
238
- renderedHTML : { default : null } ,
232
+ max : { default : 8 } ,
233
+ reverse : { default : null } ,
234
+ author : { default : null } ,
235
+ date : { default : null } ,
236
+ details : { default : null } ,
237
+ refresh : { default : '' } ,
238
+ renderedHTML : { default : null } ,
239
239
} ,
240
240
} ) ;
241
241
242
242
nodes = nodes . addToEnd ( 'dwplugin_block' , {
243
243
content : 'text*' ,
244
244
marks : '' ,
245
245
attrs : {
246
- class : { default : 'dwplugin' } ,
247
- 'data-pluginname' : { default : ' ' } ,
246
+ class : { default : 'dwplugin' } ,
247
+ 'data-pluginname' : { default : ' ' } ,
248
248
} ,
249
249
draggable : true ,
250
250
inline : false ,
@@ -261,8 +261,8 @@ export default function getSpec() {
261
261
nodes = nodes . addToEnd ( 'dwplugin_inline' , {
262
262
content : 'text*' ,
263
263
attrs : {
264
- class : { default : 'dwplugin' } ,
265
- 'data-pluginname' : { default : ' ' } ,
264
+ class : { default : 'dwplugin' } ,
265
+ 'data-pluginname' : { default : ' ' } ,
266
266
} ,
267
267
marks : '' ,
268
268
draggable : true ,
@@ -284,7 +284,7 @@ export default function getSpec() {
284
284
285
285
marks = marks . addToEnd ( 'deleted' , {
286
286
parseDOM : [
287
- { tag : 'del' } ,
287
+ { tag : 'del' } ,
288
288
{
289
289
style : 'text-decoration' ,
290
290
// https://discuss.prosemirror.net/t/dom-parsing-and-getattrs/612
@@ -298,7 +298,7 @@ export default function getSpec() {
298
298
299
299
marks = marks . addToEnd ( 'underline' , {
300
300
parseDOM : [
301
- { tag : 'u' } ,
301
+ { tag : 'u' } ,
302
302
{
303
303
style : 'text-decoration' ,
304
304
getAttrs : value => value === 'underline' && null ,
@@ -311,7 +311,7 @@ export default function getSpec() {
311
311
312
312
marks = marks . addToEnd ( 'subscript' , {
313
313
parseDOM : [
314
- { tag : 'sub' } ,
314
+ { tag : 'sub' } ,
315
315
{
316
316
style : 'vertical-align' ,
317
317
getAttrs : value => value === 'sub' && null ,
@@ -324,7 +324,7 @@ export default function getSpec() {
324
324
325
325
marks = marks . addToEnd ( 'superscript' , {
326
326
parseDOM : [
327
- { tag : 'sup' } ,
327
+ { tag : 'sup' } ,
328
328
{
329
329
style : 'vertical-align' ,
330
330
getAttrs : value => value === 'super' && null ,
@@ -338,15 +338,15 @@ export default function getSpec() {
338
338
marks = marks . addToEnd ( 'unformatted' , {
339
339
excludes : '_' ,
340
340
toDOM ( ) {
341
- return [ 'span' , { class : 'unformatted' } ] ;
341
+ return [ 'span' , { class : 'unformatted' } ] ;
342
342
} ,
343
343
} ) ;
344
344
345
345
if ( window . Prosemirror && window . Prosemirror . pluginSchemas ) {
346
346
window . Prosemirror . pluginSchemas . forEach ( ( addSchema ) => {
347
- ( { nodes, marks} = addSchema ( nodes , marks ) ) ;
347
+ ( { nodes, marks } = addSchema ( nodes , marks ) ) ;
348
348
} ) ;
349
349
}
350
350
351
- return { nodes, marks} ;
351
+ return { nodes, marks } ;
352
352
}
0 commit comments