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

fix strong

parent 2438b761
No related branches found
No related tags found
1 merge request!304Answer nodeview
const strong = {
parseDOM: [
{ tag: "strong" },
{ tag: 'strong' },
// This works around a Google Docs misbehavior where
// pasted content will be inexplicably wrapped in `<b>`
// tags with a font-weight normal.
{ tag: 'b', getAttrs: node => node.style.fontWeight !== 'normal' && null },
{
tag: "b",
getAttrs: node => node.style.fontWeight != "normal" && null
}
// {
// style: "font-weight",
// getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
// }
style: 'font-weight',
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
},
],
toDOM(hook, next) {
hook.value = ["strong", 0];
next();
}
toDOM() {
return ['strong', 0];
},
};
export default strong;
import Service from "../../Service";
import { toggleMark } from "prosemirror-commands";
import { strongMark } from "wax-prosemirror-schema";
import Strong from "./Strong";
import Service from '../../Service';
import { toggleMark } from 'prosemirror-commands';
import { strongMark } from 'wax-prosemirror-schema';
import Strong from './Strong';
class StrongService extends Service {
boot() {
const shortCuts = this.container.get("ShortCuts");
shortCuts.addShortCut({ "Mod-b": toggleMark(this.schema.marks.strong) });
const shortCuts = this.container.get('ShortCuts');
shortCuts.addShortCut({ 'Mod-b': toggleMark(this.schema.marks.strong) });
}
register() {
this.container.bind("Strong").to(Strong);
const createMark = this.container.get("CreateMark");
createMark(
{
strong: strongMark
},
{ toWaxSchema: true }
);
this.container.bind('Strong').to(Strong);
const createMark = this.container.get('CreateMark');
createMark({
strong: strongMark,
});
}
}
......
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