Skip to content
Snippets Groups Projects
Commit ee7edf9e authored by Giannis Kopanas's avatar Giannis Kopanas
Browse files

fix(schema): add prosemirrorschema

parent 7e45d943
No related branches found
No related tags found
1 merge request!45Develop
...@@ -11,7 +11,7 @@ import { ...@@ -11,7 +11,7 @@ import {
TextStyleService, TextStyleService,
InlineAnnotationsService, InlineAnnotationsService,
LinkService, LinkService,
OverlayService OverlayService,
ListsService, ListsService,
ListToolGroupService, ListToolGroupService,
TablesService, TablesService,
......
...@@ -6,39 +6,6 @@ export const WaxContext = React.createContext({ ...@@ -6,39 +6,6 @@ export const WaxContext = React.createContext({
updateView: null updateView: null
}); });
// export default class WaxContextComponent extends Component {
// constructor(props) {
// super(props);
// console.log("tesss");
// this.state = {
// app: props.app,
// view: props.view,
// updateView: view => {
// this.setState(view);
// }
// };
// }
// componentWillReceiveProps(next, prev) {
// console.log(next, prev);
// }
// render() {
// console.log("provider");
// return (
// <WaxContext.Provider
// value={{
// app: this.state.app,
// view: this.state.view,
// updateView: this.state.updateView
// }}
// >
// {this.props.children}
// </WaxContext.Provider>
// );
// }
// }
export default props => { export default props => {
const [context, setContext] = useState({ const [context, setContext] = useState({
app: props.app, app: props.app,
......
...@@ -333,10 +333,6 @@ const nodes = { ...@@ -333,10 +333,6 @@ const nodes = {
toDOM() { toDOM() {
return blockquoteDOM; return blockquoteDOM;
} }
}, }
...tableNodes({
tableGroup: "block",
cellContent: "block+"
})
}; };
export default nodes; export default nodes;
export { default as MenuService } from "./src/MenuService/MenuService"; export { default as MenuService } from "./src/MenuService/MenuService";
export { default as RedoUndoService } from "./src/RedoUndoService/RedoUndoService";
export { default as AnnotationService } from "./src/AnnotationService/AnnotationService";
export { default as PlaceholderService } from "./src/PlaceholderService/PlaceholderService";
export { default as LinkService } from "./src/LinkService/LinkService"; export { default as LinkService } from "./src/LinkService/LinkService";
export { default as TextStyleService } from "./src/TextStyleService/TextStyleService"; export { default as TextStyleService } from "./src/TextStyleService/TextStyleService";
......
...@@ -11,13 +11,13 @@ class StrongService extends Service { ...@@ -11,13 +11,13 @@ class StrongService extends Service {
register() { register() {
this.container.bind("Strong").to(Strong); this.container.bind("Strong").to(Strong);
const createMark = this.container.get("CreateMark");
this.container createMark(
.bind("schema") {
.toConstantValue({
strong: strongMark strong: strongMark
}) },
.whenTargetNamed("mark"); { toWaxSchema: true }
);
} }
} }
......
...@@ -2,9 +2,7 @@ import ListsServices from "./index"; ...@@ -2,9 +2,7 @@ import ListsServices from "./index";
import Service from "wax-prosemirror-core/src/services/Service"; import Service from "wax-prosemirror-core/src/services/Service";
class ListsService extends Service { class ListsService extends Service {
register() { dependencies = ListsServices;
this.config.pushToArray("services", ListsServices);
}
} }
export default ListsService; export default ListsService;
...@@ -6,6 +6,7 @@ export default class Node { ...@@ -6,6 +6,7 @@ export default class Node {
name = ""; name = "";
importer = {}; importer = {};
isolating = false;
inline = false; inline = false;
group = ""; group = "";
content = ""; content = "";
...@@ -59,6 +60,7 @@ export default class Node { ...@@ -59,6 +60,7 @@ export default class Node {
inline: this.inline, inline: this.inline,
group: this.group, group: this.group,
content: this.content, content: this.content,
isolating: this.isolating,
draggable: this.draggable, draggable: this.draggable,
attrs: this._attrs, attrs: this._attrs,
parseDOM: this._parseRules.map(rule => rule.combineRules()), parseDOM: this._parseRules.map(rule => rule.combineRules()),
......
...@@ -13,29 +13,30 @@ export default class SchemaService extends Service { ...@@ -13,29 +13,30 @@ export default class SchemaService extends Service {
.inSingletonScope(); .inSingletonScope();
this.container.bind("CreateNode").toFactory(context => { this.container.bind("CreateNode").toFactory(context => {
return (schema, options) => { return (schema, options = { toWaxSchema: false }) => {
if (options.toWaxSchema) { if (options.toWaxSchema) {
context context.container
.bind("schema") .bind("schema")
.toConstantValue(schema) .toConstantValue(schema)
.whenTargetNamed("node"); .whenTargetNamed("node");
} else { } else {
const schema = context.get("Schema"); const schemaInstance = context.container.get("Schema");
schema.addProsemirrorSchema(schema, "nodes");
schemaInstance.addProsemirrorSchema(schema, "nodes");
} }
}; };
}); });
this.container.bind("CreateMark").toFactory(context => { this.container.bind("CreateMark").toFactory(context => {
return (schema, options) => { return (schema, options = { toWaxSchema: false }) => {
if (options.toWaxSchema) { if (options.toWaxSchema) {
context context.container
.bind("schema") .bind("schema")
.toConstantValue(schema) .toConstantValue(schema)
.whenTargetNamed("mark"); .whenTargetNamed("mark");
} else { } else {
const schema = context.get("Schema"); const schemaInstance = context.container.get("Schema");
schema.addProsemirrorSchema(schema, "marks"); schemaInstance.addProsemirrorSchema(schema, "marks");
} }
}; };
}); });
......
...@@ -7,6 +7,25 @@ class InsertTableService extends Service { ...@@ -7,6 +7,25 @@ class InsertTableService extends Service {
register() { register() {
this.container.bind("Table").to(Table); this.container.bind("Table").to(Table);
const createNode = this.container.get("CreateNode");
const { table, table_row, table_cell, table_header } = tableNodes({
tableGroup: "block",
cellContent: "block+"
});
createNode({
table
});
createNode({
table_row
});
createNode({
table_cell
});
createNode({
table_header
});
} }
} }
......
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