fix: Fixed issue with Keep HTML imports not working
This commit is contained in:
@@ -3,6 +3,8 @@ import { DecryptedItemInterface, FileItem, ItemContent, NoteContent, SNNote, SNT
|
||||
import { ConversionResult } from './ConversionResult'
|
||||
import { SuperConverterHTMLOptions } from '@standardnotes/snjs'
|
||||
|
||||
export type HTMLToSuperConverterFunction = (html: string, options?: SuperConverterHTMLOptions) => string
|
||||
|
||||
export interface Converter {
|
||||
getImportType(): string
|
||||
|
||||
@@ -19,7 +21,7 @@ export interface Converter {
|
||||
canUploadFiles: boolean
|
||||
uploadFile: UploadFileFn
|
||||
canUseSuper: boolean
|
||||
convertHTMLToSuper: (html: string, options?: SuperConverterHTMLOptions) => string
|
||||
convertHTMLToSuper: HTMLToSuperConverterFunction
|
||||
convertMarkdownToSuper: (markdown: string) => string
|
||||
readFileAsText: (file: File) => Promise<string>
|
||||
linkItems(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user