diff --git a/editors/editoria/src/config/config.js b/editors/editoria/src/config/config.js index 783887b8dc9b7729c652aeb9ca7a4494c7cc27b0..dabe19bde78b8fbb85ff316301e8222815ab12d0 100644 --- a/editors/editoria/src/config/config.js +++ b/editors/editoria/src/config/config.js @@ -39,103 +39,71 @@ import invisibles, { } from '@guardian/prosemirror-invisibles'; export default { - // MenuService: [ - // { - // templateArea: 'topBar', - // toolGroups: [ - // 'Base', - // { - // name: 'Annotations', - // more: ['Superscript', 'Subscript', 'SmallCaps'], - // }, - // 'Notes', - // 'Lists', - // 'Images', - // 'CodeBlock', - // 'Tables', - // 'TrackingAndEditing', - // ], - // }, - // { - // templateArea: 'leftSideBar', - // toolGroups: ['DisplayText'], - // }, - // ], - - SchemaService: { - nodes: { - doc: { - content: 'inline*', - }, - text: { - group: 'inline', - }, - paragraph: null, - hard_break: null, - title: { - group: 'inline', - content: 'inline*', - inline: true, - parseDOM: [ - { - tag: 'title', - }, - ], - toDOM(node) { - return ['title', node.attrs, 0]; + MenuService: [ + { + templateArea: 'topBar', + toolGroups: [ + 'Base', + { + name: 'Annotations', + more: ['Superscript', 'Subscript', 'SmallCaps'], }, - }, + 'Notes', + 'Lists', + 'Images', + 'CodeBlock', + 'Tables', + 'TrackingAndEditing', + ], }, - marks: { - em: { - parseDOM: [{ tag: 'i' }, { tag: 'em' }, { style: 'font-style=italic' }], - toDOM(mark) { - return [('em', 0)]; - }, - }, + { + templateArea: 'leftSideBar', + toolGroups: ['DisplayText'], }, - }, + ], - // RulesService: [emDash, ellipsis], - // ShortCutsService: {}, - // EnableTrackChangeService: { enabled: false }, + SchemaService: {}, - // PmPlugins: [ - // columnResizing(), - // tableEditing(), - // invisibles([hardBreak()]), - // WaxSelectionPlugin, - // ], + RulesService: [emDash, ellipsis], + ShortCutsService: {}, + EnableTrackChangeService: { enabled: false }, + + PmPlugins: [ + columnResizing(), + tableEditing(), + invisibles([hardBreak()]), + WaxSelectionPlugin, + ], // Always load first CommentsService and LinkService, //as it matters on how PM treats nodes and marks services: [ - // new DisplayBlockLevelService(), - // new DisplayToolGroupService(), - // new TextBlockLevelService(), - // new TextToolGroupService(), - // new ListsService(), - // new LinkService(), - // new InlineAnnotationsService(), - // new TrackChangeService(), - // new CommentsService(), - // new PlaceholderService(), - // new ImageService(), - // new TablesService(), - // new BaseService(), - // new BaseToolGroupService(), - // new NoteService(), - // new TableToolGroupService(), - // new ImageToolGroupService(), - // new AnnotationToolGroupService(), - // new NoteToolGroupService(), - // new ListToolGroupService(), - // new CodeBlockService(), - // new CodeBlockToolGroupService(), - // new TrackChangeToolGroupService(), - // new DisplayTextToolGroupService(), - // new MathService(), - // new FindAndReplaceService(), - // new TrackingAndEditingToolGroupService(), + new DisplayBlockLevelService(), + new DisplayToolGroupService(), + new TextBlockLevelService(), + new TextToolGroupService(), + new ListsService(), + new LinkService(), + new InlineAnnotationsService(), + new TrackChangeService(), + new CommentsService(), + new PlaceholderService(), + new ImageService(), + new TablesService(), + new BaseService(), + new BaseToolGroupService(), + new NoteService(), + new TableToolGroupService(), + new ImageToolGroupService(), + new AnnotationToolGroupService(), + new NoteToolGroupService(), + new ListToolGroupService(), + new CodeBlockService(), + new CodeBlockToolGroupService(), + new TrackChangeToolGroupService(), + new DisplayTextToolGroupService(), + new MathService(), + new FindAndReplaceService(), + new TrackingAndEditingToolGroupService(), ], }; diff --git a/editors/editoria/src/config/defaultSchema.js b/editors/editoria/src/config/defaultSchema.js new file mode 100644 index 0000000000000000000000000000000000000000..8cbf09314e18016c47822b6a438744e16ba3f428 --- /dev/null +++ b/editors/editoria/src/config/defaultSchema.js @@ -0,0 +1,28 @@ +const defaultSchema = { + nodes: { + doc: { + content: 'inline*', + }, + text: { + group: 'inline', + }, + paragraph: null, + hard_break: null, + title: { + group: 'inline', + content: 'inline*', + inline: true, + parseDOM: [ + { + tag: 'title', + }, + ], + toDOM(node) { + return ['title', node.attrs, 0]; + }, + }, + }, + marks: {}, +}; + +export default defaultSchema; diff --git a/wax-prosemirror-core/src/Application.js b/wax-prosemirror-core/src/Application.js index 8fb3e16f7374c865f1bd0ab94ffbecfa70415b7c..40916f3a4d93c55beecf018b728cb1c924deb7d6 100644 --- a/wax-prosemirror-core/src/Application.js +++ b/wax-prosemirror-core/src/Application.js @@ -54,7 +54,6 @@ export default class Application { getSchema() { this.schema = this.container.get('Schema'); - console.log(this.schema.getSchema()); return this.schema.getSchema(); } diff --git a/wax-prosemirror-core/src/Wax.js b/wax-prosemirror-core/src/Wax.js index abed11e921059f3459358bab4ecad296b45e4b35..ccff04147b5cf50860916025e099d4e8086294f9 100644 --- a/wax-prosemirror-core/src/Wax.js +++ b/wax-prosemirror-core/src/Wax.js @@ -15,12 +15,9 @@ const parser = schema => { const WaxParser = DOMParser.fromSchema(schema); return content => { - console.log(content); const container = document.createElement('article'); container.innerHTML = content; - console.log(container.innerHTML); - console.log(WaxParser.parse(container)); return WaxParser.parse(container); }; }; diff --git a/wax-prosemirror-services/src/SchemaService/DefaultSchema.js b/wax-prosemirror-services/src/SchemaService/DefaultSchema.js index 8e636c9ebeb35f46c8e3a062dc2e889c5383c31c..26295da1435fc629db431c5f0e750133663e1c70 100644 --- a/wax-prosemirror-services/src/SchemaService/DefaultSchema.js +++ b/wax-prosemirror-services/src/SchemaService/DefaultSchema.js @@ -3,16 +3,23 @@ import { SchemaHelpers } from 'wax-prosemirror-utilities'; export default { nodes: { doc: { - content: 'inline+', + content: 'block+', }, text: { group: 'inline', }, - - paragraph: { + hard_break: { + inline: true, group: 'inline', + selectable: false, + parseDOM: [{ tag: 'br' }], + toDOM() { + return ['br']; + }, + }, + paragraph: { + group: 'block', content: 'inline*', - inline: true, attrs: { id: { default: '' }, class: { default: 'paragraph' }, @@ -37,15 +44,6 @@ export default { return ['p', attrs, 0]; }, }, - hard_break: { - inline: true, - group: 'inline', - selectable: false, - parseDOM: [{ tag: 'br' }], - toDOM() { - return ['br']; - }, - }, }, marks: {}, };