Merge pull request #1527 from omnivore-app/upsize-highlight-max-length

Upsize max highlight char length to 6000
This commit is contained in:
Hongbo Wu 2022-12-09 15:52:12 +08:00 committed by GitHub
commit f3f1dfc69c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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)
@ -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)

View file

@ -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)