44 * extends the basic schemas provided by ProseMirror
55 */
66
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' ;
1010
1111export default function getSpec ( ) {
12- let { nodes, marks} = schemaBasic . spec ;
12+ let { nodes, marks } = schemaBasic . spec ;
1313
1414 const doc = nodes . get ( 'doc' ) ;
1515 doc . content = '(block | baseonly | container | protected_block | substitution_block)+' ;
1616 doc . attrs = {
17- nocache : { default : false } ,
18- notoc : { default : false } ,
17+ nocache : { default : false } ,
18+ notoc : { default : false } ,
1919 } ;
2020 nodes = nodes . update ( 'doc' , doc ) ;
2121
@@ -58,7 +58,7 @@ export default function getSpec() {
5858
5959 const tableNode = nodes . get ( 'table' ) ;
6060 tableNode . toDOM = function toDOM ( ) {
61- return [ 'div' , { class : 'table' } , [ 'table' , { class : 'inline' } , [ 'tbody' , 0 ] ] ] ;
61+ return [ 'div' , { class : 'table' } , [ 'table' , { class : 'inline' } , [ 'tbody' , 0 ] ] ] ;
6262 } ;
6363 nodes . update ( 'table' , tableNode ) ;
6464
@@ -69,15 +69,15 @@ export default function getSpec() {
6969 group : 'protected_block' ,
7070 code : true ,
7171 toDOM ( ) {
72- return [ 'pre' , { class : 'code' } , 0 ] ;
72+ return [ 'pre' , { class : 'code' } , 0 ] ;
7373 } ,
7474 } ) ;
7575
7676 const codeBlock = nodes . get ( 'code_block' ) ;
7777 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 : '' } ,
8181 } ;
8282 codeBlock . toDOM = function toDOM ( node ) {
8383 return [ 'pre' , node . attrs , 0 ] ;
@@ -88,16 +88,16 @@ export default function getSpec() {
8888 const quote = nodes . get ( 'blockquote' ) ;
8989 quote . content = '(block | blockquote | protected_block)+' ;
9090 quote . group = 'container' ;
91- quote . toDom = ( ) => [ 'blockquote' , { } , [ 'div' , { class : 'no' } , 0 ] ] ;
91+ quote . toDom = ( ) => [ 'blockquote' , { } , [ 'div' , { class : 'no' } , 0 ] ] ;
9292 nodes . update ( 'blockquote' , quote ) ;
9393
9494 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 : '' } ;
101101 imageNode . attrs . id = { } ;
102102 delete imageNode . attrs . src ;
103103 imageNode . parseDOM = [
@@ -162,7 +162,7 @@ export default function getSpec() {
162162
163163 const imageAttrs = { } ;
164164 Object . keys ( imageNode . attrs ) . forEach ( ( key ) => {
165- imageAttrs [ `image-${ key } ` ] = { default : null } ;
165+ imageAttrs [ `image-${ key } ` ] = { default : null } ;
166166 } ) ;
167167
168168 nodes = nodes . addToEnd ( 'link' , {
@@ -171,13 +171,13 @@ export default function getSpec() {
171171 attrs : {
172172 'data-type' : { } ,
173173 '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 : '' } ,
181181 ...imageAttrs ,
182182 } ,
183183 toDOM ( node ) {
@@ -189,7 +189,7 @@ export default function getSpec() {
189189 content : '' ,
190190 marks : '' ,
191191 attrs : {
192- contentJSON : { default : '' } ,
192+ contentJSON : { default : '' } ,
193193 } ,
194194 group : 'inline' ,
195195 inline : true ,
@@ -218,7 +218,7 @@ export default function getSpec() {
218218 return false ;
219219 }
220220 const syntax = dom . getAttribute ( 'alt' ) ;
221- return { icon, syntax} ;
221+ return { icon, syntax } ;
222222 } ,
223223 } ] ,
224224 } ) ;
@@ -227,24 +227,24 @@ export default function getSpec() {
227227 group : 'substitution_block' ,
228228 atom : true ,
229229 attrs : {
230- class : { default : 'rss' } ,
230+ class : { default : 'rss' } ,
231231 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 } ,
239239 } ,
240240 } ) ;
241241
242242 nodes = nodes . addToEnd ( 'dwplugin_block' , {
243243 content : 'text*' ,
244244 marks : '' ,
245245 attrs : {
246- class : { default : 'dwplugin' } ,
247- 'data-pluginname' : { default : ' ' } ,
246+ class : { default : 'dwplugin' } ,
247+ 'data-pluginname' : { default : ' ' } ,
248248 } ,
249249 draggable : true ,
250250 inline : false ,
@@ -261,8 +261,8 @@ export default function getSpec() {
261261 nodes = nodes . addToEnd ( 'dwplugin_inline' , {
262262 content : 'text*' ,
263263 attrs : {
264- class : { default : 'dwplugin' } ,
265- 'data-pluginname' : { default : ' ' } ,
264+ class : { default : 'dwplugin' } ,
265+ 'data-pluginname' : { default : ' ' } ,
266266 } ,
267267 marks : '' ,
268268 draggable : true ,
@@ -284,7 +284,7 @@ export default function getSpec() {
284284
285285 marks = marks . addToEnd ( 'deleted' , {
286286 parseDOM : [
287- { tag : 'del' } ,
287+ { tag : 'del' } ,
288288 {
289289 style : 'text-decoration' ,
290290 // https://discuss.prosemirror.net/t/dom-parsing-and-getattrs/612
@@ -298,7 +298,7 @@ export default function getSpec() {
298298
299299 marks = marks . addToEnd ( 'underline' , {
300300 parseDOM : [
301- { tag : 'u' } ,
301+ { tag : 'u' } ,
302302 {
303303 style : 'text-decoration' ,
304304 getAttrs : value => value === 'underline' && null ,
@@ -311,7 +311,7 @@ export default function getSpec() {
311311
312312 marks = marks . addToEnd ( 'subscript' , {
313313 parseDOM : [
314- { tag : 'sub' } ,
314+ { tag : 'sub' } ,
315315 {
316316 style : 'vertical-align' ,
317317 getAttrs : value => value === 'sub' && null ,
@@ -324,7 +324,7 @@ export default function getSpec() {
324324
325325 marks = marks . addToEnd ( 'superscript' , {
326326 parseDOM : [
327- { tag : 'sup' } ,
327+ { tag : 'sup' } ,
328328 {
329329 style : 'vertical-align' ,
330330 getAttrs : value => value === 'super' && null ,
@@ -338,15 +338,15 @@ export default function getSpec() {
338338 marks = marks . addToEnd ( 'unformatted' , {
339339 excludes : '_' ,
340340 toDOM ( ) {
341- return [ 'span' , { class : 'unformatted' } ] ;
341+ return [ 'span' , { class : 'unformatted' } ] ;
342342 } ,
343343 } ) ;
344344
345345 if ( window . Prosemirror && window . Prosemirror . pluginSchemas ) {
346346 window . Prosemirror . pluginSchemas . forEach ( ( addSchema ) => {
347- ( { nodes, marks} = addSchema ( nodes , marks ) ) ;
347+ ( { nodes, marks } = addSchema ( nodes , marks ) ) ;
348348 } ) ;
349349 }
350350
351- return { nodes, marks} ;
351+ return { nodes, marks } ;
352352}
0 commit comments