@paperbits/prosemirror
Advanced tools
Comparing version 0.1.38 to 0.1.39
{ | ||
"name": "@paperbits/prosemirror", | ||
"version": "0.1.38", | ||
"version": "0.1.39", | ||
"description": "Paperbits HTML editor based on ProseMirror.", | ||
@@ -19,3 +19,3 @@ "author": "Paperbits", | ||
"dependencies": { | ||
"@paperbits/common": "0.1.38", | ||
"@paperbits/common": "0.1.39", | ||
"prosemirror-commands": "^1.0.7", | ||
@@ -22,0 +22,0 @@ "prosemirror-history": "^1.0.3", |
import { IEventManager } from "@paperbits/common/events"; | ||
import { IStyleService } from "@paperbits/common/styles"; | ||
import { IStyleCompiler } from "@paperbits/common/styles"; | ||
import { IHtmlEditor, SelectionState, HtmlEditorEvents, HyperlinkContract } from "@paperbits/common/editing"; | ||
@@ -15,3 +15,2 @@ import { Schema, DOMParser } from "prosemirror-model"; | ||
import { HyperlinkModel } from "@paperbits/common/permalinks"; | ||
import { IViewManager } from "@paperbits/common/ui"; | ||
@@ -33,3 +32,3 @@ const alignmentStyleKeys = { | ||
readonly eventManager: IEventManager, | ||
readonly styleService: IStyleService, | ||
readonly styleCompiler: IStyleCompiler, | ||
// readonly viewManager: IViewManager | ||
@@ -59,3 +58,3 @@ ) { | ||
const builder = new SchemaBuilder(this.styleService); | ||
const builder = new SchemaBuilder(this.styleCompiler); | ||
this.schema = builder.build(); | ||
@@ -150,3 +149,3 @@ } | ||
while (endIndex < $cursor.parent.childCount && hasMark(endIndex)) { | ||
endIndex++ | ||
endIndex++; | ||
} | ||
@@ -213,9 +212,4 @@ | ||
const state = this.editorView.state; | ||
const colorMark = state.selection.$from.marks().find(x => x.type.name === "color"); | ||
if (!colorMark) { | ||
return; | ||
} | ||
this.editorView.dispatch(state.tr.removeMark(state.selection.from, state.selection.to, this.schema.marks.color)); | ||
this.editorView.focus(); | ||
} | ||
@@ -222,0 +216,0 @@ |
import { Schema } from "prosemirror-model"; | ||
import { IStyleService } from "@paperbits/common/styles"; | ||
import { IStyleCompiler } from "@paperbits/common/styles"; | ||
export class SchemaBuilder { | ||
constructor(private readonly styleService: IStyleService) { | ||
constructor(private readonly styleCompiler: IStyleCompiler) { | ||
} | ||
@@ -18,3 +18,3 @@ | ||
if (node.attrs.styles) { | ||
const className = this.styleService.getClassNamesByStyleConfig(node.attrs.styles); | ||
const className = this.styleCompiler.getClassNamesByStyleConfig(node.attrs.styles); | ||
return [tag, { class: className }, 0]; | ||
@@ -136,3 +136,3 @@ } | ||
toDOM: (node) => { | ||
const className = this.styleService.getClassNameByColorKey(node.attrs.colorKey); | ||
const className = this.styleCompiler.getClassNameByColorKey(node.attrs.colorKey); | ||
return ["span", { class: className }]; | ||
@@ -139,0 +139,0 @@ } |
1591
7
11
3
34
37334
823
+ Added@paperbits/common@0.1.39(transitive)
- Removed@paperbits/common@0.1.38(transitive)
Updated@paperbits/common@0.1.39