tabs to spaces whitespace
This commit is contained in:
@@ -3,43 +3,43 @@ import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
|
||||
export default class Bold extends Mark {
|
||||
|
||||
get name() {
|
||||
return 'bold'
|
||||
}
|
||||
get name() {
|
||||
return 'bold'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'strong',
|
||||
},
|
||||
{
|
||||
tag: 'b',
|
||||
getAttrs: node => node.style.fontWeight !== 'normal' && null,
|
||||
},
|
||||
{
|
||||
style: 'font-weight',
|
||||
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
|
||||
},
|
||||
],
|
||||
toDOM: () => ['strong', 0],
|
||||
}
|
||||
}
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'strong',
|
||||
},
|
||||
{
|
||||
tag: 'b',
|
||||
getAttrs: node => node.style.fontWeight !== 'normal' && null,
|
||||
},
|
||||
{
|
||||
style: 'font-weight',
|
||||
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
|
||||
},
|
||||
],
|
||||
toDOM: () => ['strong', 0],
|
||||
}
|
||||
}
|
||||
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-b': toggleMark(type),
|
||||
}
|
||||
}
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-b': toggleMark(type),
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, type),
|
||||
]
|
||||
}
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,33 +3,33 @@ import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
|
||||
export default class Code extends Mark {
|
||||
|
||||
get name() {
|
||||
return 'code'
|
||||
}
|
||||
get name() {
|
||||
return 'code'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{ tag: 'code' },
|
||||
],
|
||||
toDOM: () => ['code', 0],
|
||||
}
|
||||
}
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{ tag: 'code' },
|
||||
],
|
||||
toDOM: () => ['code', 0],
|
||||
}
|
||||
}
|
||||
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-`': toggleMark(type),
|
||||
}
|
||||
}
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-`': toggleMark(type),
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:`)([^`]+)(?:`)$/, type),
|
||||
]
|
||||
}
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:`)([^`]+)(?:`)$/, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,35 +3,35 @@ import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
|
||||
export default class Italic extends Mark {
|
||||
|
||||
get name() {
|
||||
return 'italic'
|
||||
}
|
||||
get name() {
|
||||
return 'italic'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{ tag: 'i' },
|
||||
{ tag: 'em' },
|
||||
{ style: 'font-style=italic' },
|
||||
],
|
||||
toDOM: () => ['em', 0],
|
||||
}
|
||||
}
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{ tag: 'i' },
|
||||
{ tag: 'em' },
|
||||
{ style: 'font-style=italic' },
|
||||
],
|
||||
toDOM: () => ['em', 0],
|
||||
}
|
||||
}
|
||||
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-i': toggleMark(type),
|
||||
}
|
||||
}
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-i': toggleMark(type),
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:^|[^*_])(?:\*|_)([^*_]+)(?:\*|_)$/, type),
|
||||
]
|
||||
}
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/(?:^|[^*_])(?:\*|_)([^*_]+)(?:\*|_)$/, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,41 +3,41 @@ import { updateMark, removeMark } from 'tiptap-commands'
|
||||
|
||||
export default class Link extends Mark {
|
||||
|
||||
get name() {
|
||||
return 'link'
|
||||
}
|
||||
get name() {
|
||||
return 'link'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
attrs: {
|
||||
href: {
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
inclusive: false,
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'a[href]',
|
||||
getAttrs: dom => ({
|
||||
href: dom.getAttribute('href'),
|
||||
}),
|
||||
},
|
||||
],
|
||||
toDOM: node => ['a', {
|
||||
...node.attrs,
|
||||
rel: 'noopener noreferrer nofollow',
|
||||
}, 0],
|
||||
}
|
||||
}
|
||||
get schema() {
|
||||
return {
|
||||
attrs: {
|
||||
href: {
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
inclusive: false,
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'a[href]',
|
||||
getAttrs: dom => ({
|
||||
href: dom.getAttribute('href'),
|
||||
}),
|
||||
},
|
||||
],
|
||||
toDOM: node => ['a', {
|
||||
...node.attrs,
|
||||
rel: 'noopener noreferrer nofollow',
|
||||
}, 0],
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return attrs => {
|
||||
if (attrs.href) {
|
||||
return updateMark(type, attrs)
|
||||
}
|
||||
commands({ type }) {
|
||||
return attrs => {
|
||||
if (attrs.href) {
|
||||
return updateMark(type, attrs)
|
||||
}
|
||||
|
||||
return removeMark(type)
|
||||
}
|
||||
}
|
||||
return removeMark(type)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,45 +3,45 @@ import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
|
||||
export default class Strike extends Mark {
|
||||
|
||||
get name() {
|
||||
return 'strike'
|
||||
}
|
||||
get name() {
|
||||
return 'strike'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 's',
|
||||
},
|
||||
{
|
||||
tag: 'del',
|
||||
},
|
||||
{
|
||||
tag: 'strike',
|
||||
},
|
||||
{
|
||||
style: 'text-decoration',
|
||||
getAttrs: value => value === 'line-through',
|
||||
},
|
||||
],
|
||||
toDOM: () => ['s', 0],
|
||||
}
|
||||
}
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 's',
|
||||
},
|
||||
{
|
||||
tag: 'del',
|
||||
},
|
||||
{
|
||||
tag: 'strike',
|
||||
},
|
||||
{
|
||||
style: 'text-decoration',
|
||||
getAttrs: value => value === 'line-through',
|
||||
},
|
||||
],
|
||||
toDOM: () => ['s', 0],
|
||||
}
|
||||
}
|
||||
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-d': toggleMark(type),
|
||||
}
|
||||
}
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-d': toggleMark(type),
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/~([^~]+)~$/, type),
|
||||
]
|
||||
}
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
markInputRule(/~([^~]+)~$/, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,33 +3,33 @@ import { toggleMark } from 'tiptap-commands'
|
||||
|
||||
export default class Underline extends Mark {
|
||||
|
||||
get name() {
|
||||
return 'underline'
|
||||
}
|
||||
get name() {
|
||||
return 'underline'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'u',
|
||||
},
|
||||
{
|
||||
style: 'text-decoration',
|
||||
getAttrs: value => value === 'underline',
|
||||
},
|
||||
],
|
||||
toDOM: () => ['u', 0],
|
||||
}
|
||||
}
|
||||
get schema() {
|
||||
return {
|
||||
parseDOM: [
|
||||
{
|
||||
tag: 'u',
|
||||
},
|
||||
{
|
||||
style: 'text-decoration',
|
||||
getAttrs: value => value === 'underline',
|
||||
},
|
||||
],
|
||||
toDOM: () => ['u', 0],
|
||||
}
|
||||
}
|
||||
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-u': toggleMark(type),
|
||||
}
|
||||
}
|
||||
keys({ type }) {
|
||||
return {
|
||||
'Mod-u': toggleMark(type),
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
commands({ type }) {
|
||||
return () => toggleMark(type)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user