From 5fc18770ad57c51692840e90868d72c1ee47de18 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 9 Dec 2022 15:24:10 +0800 Subject: [PATCH 1/3] Upsize max highlight char length to 6000 --- packages/api/src/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/schema.ts b/packages/api/src/schema.ts index 08627447d..ded7fc511 100755 --- a/packages/api/src/schema.ts +++ b/packages/api/src/schema.ts @@ -668,7 +668,7 @@ const schema = gql` shortId: String! articleId: ID! patch: String! - quote: String! @sanitize(maxLength: 2000) + quote: String! @sanitize(maxLength: 6000) prefix: String @sanitize suffix: String @sanitize annotation: String @sanitize(maxLength: 4000) From f4fa9cb15b08c913c57b619c72001973fc85c53b Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 9 Dec 2022 15:29:15 +0800 Subject: [PATCH 2/3] do the same for merge highlight --- packages/api/src/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/schema.ts b/packages/api/src/schema.ts index ded7fc511..2399578a3 100755 --- a/packages/api/src/schema.ts +++ b/packages/api/src/schema.ts @@ -700,7 +700,7 @@ const schema = gql` shortId: ID! articleId: ID! patch: String! - quote: String! @sanitize(maxLength: 2000) + quote: String! @sanitize(maxLength: 6000) prefix: String @sanitize suffix: String @sanitize annotation: String @sanitize(maxLength: 8000) From be44636aa6d7bc36a9ffb2cd1f8e87e4b1596b46 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 9 Dec 2022 15:40:34 +0800 Subject: [PATCH 3/3] Update web --- packages/web/lib/highlights/highlightGenerator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web/lib/highlights/highlightGenerator.ts b/packages/web/lib/highlights/highlightGenerator.ts index a0f20afb6..519e4549e 100644 --- a/packages/web/lib/highlights/highlightGenerator.ts +++ b/packages/web/lib/highlights/highlightGenerator.ts @@ -12,7 +12,7 @@ const highlightTag = 'omnivore_highlight' const highlightClassname = 'highlight' const highlightWithNoteClassName = 'highlight_with_note' const articleContainerId = 'article-container' -export const maxHighlightLength = 2000 +export const maxHighlightLength = 6000 const nonParagraphTagsRegEx = /^(a|b|basefont|bdo|big|em|font|i|s|small|span|strike|strong|su[bp]|tt|u|code|mark)$/i @@ -122,9 +122,9 @@ export function makeHighlightNodeAttributes( const { parentNode, nextSibling } = node let isPre = false - const nodeElement = (node instanceof HTMLElement) ? node : node.parentElement + const nodeElement = node instanceof HTMLElement ? node : node.parentElement if (nodeElement) { - isPre = (window.getComputedStyle(nodeElement).whiteSpace.startsWith('pre')) + isPre = window.getComputedStyle(nodeElement).whiteSpace.startsWith('pre') } parentNode?.removeChild(node)