Skip to content
Snippets Groups Projects
Commit f461f232 authored by chris's avatar chris
Browse files

add new schema

parent bd84a42e
No related branches found
No related tags found
1 merge request!194Default schema
...@@ -39,103 +39,71 @@ import invisibles, { ...@@ -39,103 +39,71 @@ import invisibles, {
} from '@guardian/prosemirror-invisibles'; } from '@guardian/prosemirror-invisibles';
export default { export default {
// MenuService: [ MenuService: [
// { {
// templateArea: 'topBar', templateArea: 'topBar',
// toolGroups: [ toolGroups: [
// 'Base', 'Base',
// { {
// name: 'Annotations', name: 'Annotations',
// more: ['Superscript', 'Subscript', 'SmallCaps'], 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];
}, },
}, 'Notes',
'Lists',
'Images',
'CodeBlock',
'Tables',
'TrackingAndEditing',
],
}, },
marks: { {
em: { templateArea: 'leftSideBar',
parseDOM: [{ tag: 'i' }, { tag: 'em' }, { style: 'font-style=italic' }], toolGroups: ['DisplayText'],
toDOM(mark) {
return [('em', 0)];
},
},
}, },
}, ],
// RulesService: [emDash, ellipsis], SchemaService: {},
// ShortCutsService: {},
// EnableTrackChangeService: { enabled: false },
// PmPlugins: [ RulesService: [emDash, ellipsis],
// columnResizing(), ShortCutsService: {},
// tableEditing(), EnableTrackChangeService: { enabled: false },
// invisibles([hardBreak()]),
// WaxSelectionPlugin, PmPlugins: [
// ], columnResizing(),
tableEditing(),
invisibles([hardBreak()]),
WaxSelectionPlugin,
],
// Always load first CommentsService and LinkService, // Always load first CommentsService and LinkService,
//as it matters on how PM treats nodes and marks //as it matters on how PM treats nodes and marks
services: [ services: [
// new DisplayBlockLevelService(), new DisplayBlockLevelService(),
// new DisplayToolGroupService(), new DisplayToolGroupService(),
// new TextBlockLevelService(), new TextBlockLevelService(),
// new TextToolGroupService(), new TextToolGroupService(),
// new ListsService(), new ListsService(),
// new LinkService(), new LinkService(),
// new InlineAnnotationsService(), new InlineAnnotationsService(),
// new TrackChangeService(), new TrackChangeService(),
// new CommentsService(), new CommentsService(),
// new PlaceholderService(), new PlaceholderService(),
// new ImageService(), new ImageService(),
// new TablesService(), new TablesService(),
// new BaseService(), new BaseService(),
// new BaseToolGroupService(), new BaseToolGroupService(),
// new NoteService(), new NoteService(),
// new TableToolGroupService(), new TableToolGroupService(),
// new ImageToolGroupService(), new ImageToolGroupService(),
// new AnnotationToolGroupService(), new AnnotationToolGroupService(),
// new NoteToolGroupService(), new NoteToolGroupService(),
// new ListToolGroupService(), new ListToolGroupService(),
// new CodeBlockService(), new CodeBlockService(),
// new CodeBlockToolGroupService(), new CodeBlockToolGroupService(),
// new TrackChangeToolGroupService(), new TrackChangeToolGroupService(),
// new DisplayTextToolGroupService(), new DisplayTextToolGroupService(),
// new MathService(), new MathService(),
// new FindAndReplaceService(), new FindAndReplaceService(),
// new TrackingAndEditingToolGroupService(), new TrackingAndEditingToolGroupService(),
], ],
}; };
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;
...@@ -54,7 +54,6 @@ export default class Application { ...@@ -54,7 +54,6 @@ export default class Application {
getSchema() { getSchema() {
this.schema = this.container.get('Schema'); this.schema = this.container.get('Schema');
console.log(this.schema.getSchema());
return this.schema.getSchema(); return this.schema.getSchema();
} }
......
...@@ -15,12 +15,9 @@ const parser = schema => { ...@@ -15,12 +15,9 @@ const parser = schema => {
const WaxParser = DOMParser.fromSchema(schema); const WaxParser = DOMParser.fromSchema(schema);
return content => { return content => {
console.log(content);
const container = document.createElement('article'); const container = document.createElement('article');
container.innerHTML = content; container.innerHTML = content;
console.log(container.innerHTML);
console.log(WaxParser.parse(container));
return WaxParser.parse(container); return WaxParser.parse(container);
}; };
}; };
......
...@@ -3,16 +3,23 @@ import { SchemaHelpers } from 'wax-prosemirror-utilities'; ...@@ -3,16 +3,23 @@ import { SchemaHelpers } from 'wax-prosemirror-utilities';
export default { export default {
nodes: { nodes: {
doc: { doc: {
content: 'inline+', content: 'block+',
}, },
text: { text: {
group: 'inline', group: 'inline',
}, },
hard_break: {
paragraph: { inline: true,
group: 'inline', group: 'inline',
selectable: false,
parseDOM: [{ tag: 'br' }],
toDOM() {
return ['br'];
},
},
paragraph: {
group: 'block',
content: 'inline*', content: 'inline*',
inline: true,
attrs: { attrs: {
id: { default: '' }, id: { default: '' },
class: { default: 'paragraph' }, class: { default: 'paragraph' },
...@@ -37,15 +44,6 @@ export default { ...@@ -37,15 +44,6 @@ export default {
return ['p', attrs, 0]; return ['p', attrs, 0];
}, },
}, },
hard_break: {
inline: true,
group: 'inline',
selectable: false,
parseDOM: [{ tag: 'br' }],
toDOM() {
return ['br'];
},
},
}, },
marks: {}, marks: {},
}; };
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment