fix: Fixed issue with Keep HTML imports not working

This commit is contained in:
Aman Harwara
2024-04-20 16:00:22 +05:30
parent 4810791885
commit 10c9acf061
2 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import { SNNote } from '@standardnotes/models'
import { Converter, InsertNoteFn } from '../Converter'
import { Converter, HTMLToSuperConverterFunction, InsertNoteFn } from '../Converter'
type Content =
| {
@@ -40,6 +40,10 @@ export class GoogleKeepConverter implements Converter {
console.error(error)
}
if (content.length > 0 && content.includes('class="content"')) {
return true
}
return false
}
@@ -67,7 +71,7 @@ export class GoogleKeepConverter implements Converter {
data: string,
file: { name: string },
insertNote: InsertNoteFn,
convertHTMLToSuper: (html: string) => string,
convertHTMLToSuper: HTMLToSuperConverterFunction,
canUseSuper: boolean,
): Promise<SNNote> {
const rootElement = document.createElement('html')
@@ -109,7 +113,9 @@ export class GoogleKeepConverter implements Converter {
contentElement.innerHTML = contentElement.innerHTML.replace(/<br>/g, '\n')
content = contentElement.textContent
} else {
content = convertHTMLToSuper(rootElement.innerHTML)
content = convertHTMLToSuper(rootElement.innerHTML, {
addLineBreaks: false,
})
}
if (!content) {