aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/marks_rts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/formattedText/marks_rts.ts')
-rw-r--r--src/client/views/nodes/formattedText/marks_rts.ts40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/client/views/nodes/formattedText/marks_rts.ts b/src/client/views/nodes/formattedText/marks_rts.ts
index 6e1f325cf..ba8e4faed 100644
--- a/src/client/views/nodes/formattedText/marks_rts.ts
+++ b/src/client/views/nodes/formattedText/marks_rts.ts
@@ -34,14 +34,14 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'a[href]',
- getAttrs(dom: any) {
+ getAttrs: dom => {
return {
title: dom.getAttribute('title'),
};
},
},
],
- toDOM(node: any) {
+ toDOM: node => {
const targethrefs = node.attrs.allAnchors.reduce((p: string, item: { href: string; title: string; anchorId: string }) => (p ? p + ' ' + item.href : item.href), '');
const anchorids = node.attrs.allAnchors.reduce((p: string, item: { href: string; title: string; anchorId: string }) => (p ? p + ' ' + item.anchorId : item.anchorId), '');
return ['a', { id: Utils.GenerateGuid(), class: anchorids, 'data-targethrefs': targethrefs, /* 'data-noPreview': 'true', */ 'data-linkdoc': node.attrs.linkDoc, title: node.attrs.title, style: `background: lightBlue` }, 0];
@@ -53,7 +53,7 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'div',
- getAttrs(dom: any) {
+ getAttrs: dom => {
return {
noAutoLink: dom.getAttribute('data-noAutoLink'),
};
@@ -80,7 +80,7 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'a[href]',
- getAttrs(dom: any) {
+ getAttrs: dom => {
return {
title: dom.getAttribute('title'),
noPreview: dom.getAttribute('noPreview'),
@@ -88,7 +88,7 @@ export const marks: { [index: string]: MarkSpec } = {
},
},
],
- toDOM(node: any) {
+ toDOM: node => {
const targethrefs = node.attrs.allAnchors.reduce((p: string, item: { href: string; title: string; anchorId: string }) => (p ? p + ' ' + item.href : item.href), '');
const anchorids = node.attrs.allAnchors.reduce((p: string, item: { href: string; title: string; anchorId: string }) => (p ? p + ' ' + item.anchorId : item.anchorId), '');
return node.attrs.docref && node.attrs.title
@@ -117,7 +117,7 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs(dom: any) {
+ getAttrs: dom => {
return { fontSize: dom.style.fontSize ? dom.style.fontSize.toString() : '' };
},
},
@@ -131,7 +131,7 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs(dom: any) {
+ getAttrs: dom => {
const cstyle = getComputedStyle(dom);
if (cstyle.font) {
if (cstyle.font.indexOf('Times New Roman') !== -1) return { fontFamily: 'Times New Roman' };
@@ -154,7 +154,7 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs(dom: any) {
+ getAttrs: dom => {
return { color: dom.getAttribute('color') };
},
},
@@ -170,12 +170,12 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs(dom: any) {
+ getAttrs: dom => {
return { fontHighlight: dom.getAttribute('background-color') };
},
},
],
- toDOM(node: any) {
+ toDOM: node => {
return node.attrs.fontHighlight ? ['span', { style: 'background-color:' + node.attrs.fontHighlight }] : ['span', { style: 'background-color: transparent' }];
},
},
@@ -224,7 +224,7 @@ export const marks: { [index: string]: MarkSpec } = {
attrs: {
bulletType: { default: 'decimal' },
},
- toDOM(node: any) {
+ toDOM: node => {
return [
'span',
{
@@ -238,11 +238,11 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs: (p: any) => {
+ getAttrs: p => {
if (typeof p !== 'string') {
const style = getComputedStyle(p);
if (style.textDecoration === 'underline') return null;
- if (p.parentElement.outerHTML.indexOf('text-decoration: underline') !== -1 && p.parentElement.outerHTML.indexOf('text-decoration-style: solid') !== -1) {
+ if (p.parentElement?.outerHTML.indexOf('text-decoration: underline') !== -1 && p.parentElement?.outerHTML.indexOf('text-decoration-style: solid') !== -1) {
return null;
}
}
@@ -266,11 +266,11 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs: (p: any) => {
+ getAttrs: p => {
if (typeof p !== 'string') {
const style = getComputedStyle(p);
if (style.textDecoration === 'underline') return null;
- if (p.parentElement.outerHTML.indexOf('text-decoration: underline') !== -1 && p.parentElement.outerHTML.indexOf('text-decoration-style: dotted') !== -1) {
+ if (p.parentElement?.outerHTML.indexOf('text-decoration: underline') !== -1 && p.parentElement?.outerHTML.indexOf('text-decoration-style: dotted') !== -1) {
return null;
}
}
@@ -292,10 +292,10 @@ export const marks: { [index: string]: MarkSpec } = {
parseDOM: [
{
tag: 'span',
- getAttrs: (p: any) => {
+ getAttrs: p => {
if (typeof p !== 'string') {
const style = getComputedStyle(p);
- if (style.textDecoration === 'underline' || p.parentElement.outerHTML.indexOf('text-decoration-style:line') !== -1) {
+ if (style.textDecoration === 'underline' || p.parentElement?.outerHTML.indexOf('text-decoration-style:line') !== -1) {
return null;
}
}
@@ -317,7 +317,7 @@ export const marks: { [index: string]: MarkSpec } = {
selected: { default: false },
},
parseDOM: [{ style: 'background: yellow' }],
- toDOM(node: any) {
+ toDOM: node => {
return ['span', { style: `background: ${node.attrs.selected ? 'orange' : 'yellow'}` }];
},
},
@@ -330,7 +330,7 @@ export const marks: { [index: string]: MarkSpec } = {
},
excludes: 'user_mark',
group: 'inline',
- toDOM(node: any) {
+ toDOM: node => {
const uid = node.attrs.userid.replace(/\./g, '').replace(/@/g, '');
const min = Math.round(node.attrs.modified / 60);
const hr = Math.round(min / 60);
@@ -348,7 +348,7 @@ export const marks: { [index: string]: MarkSpec } = {
},
group: 'inline',
inclusive: false,
- toDOM(node: any) {
+ toDOM: node => {
const uid = node.attrs.userid.replace('.', '').replace('@', '');
return ['span', { class: 'UT-' + uid + ' UT-' + node.attrs.tag }, 0];
},