fix: Fixed issue on Android where deprecated editors wouldn't load
This commit is contained in:
@@ -10,6 +10,7 @@ import { IframeEditors } from '../Lists/IframeEditors'
|
||||
import { themes } from '../Lists/Themes'
|
||||
import { nativeEditors } from '../Lists/NativeEditors'
|
||||
import { IframeComponentFeatureDescription } from './IframeComponentFeatureDescription'
|
||||
import { ComponentArea } from '../Component/ComponentArea'
|
||||
|
||||
export function GetFeatures(): AnyFeatureDescription[] {
|
||||
return [
|
||||
@@ -54,3 +55,7 @@ export function GetNativeThemes(): ThemeFeatureDescription[] {
|
||||
export function GetDarkThemeFeature(): ThemeFeatureDescription {
|
||||
return themes().find((t) => t.identifier === NativeFeatureIdentifier.TYPES.DarkTheme) as ThemeFeatureDescription
|
||||
}
|
||||
|
||||
export function GetDeprecatedEditors(): IframeComponentFeatureDescription[] {
|
||||
return (GetDeprecatedFeatures() as IframeComponentFeatureDescription[]).filter((f) => f.area === ComponentArea.Editor)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
GetIframeEditors,
|
||||
GetNativeThemes,
|
||||
NativeFeatureIdentifier,
|
||||
GetDeprecatedEditors,
|
||||
} from '@standardnotes/features'
|
||||
import { Copy, removeFromArray, sleep, isNotUndefined, LoggerInterface } from '@standardnotes/utils'
|
||||
import { ComponentViewer } from '@Lib/Services/ComponentManager/ComponentViewer'
|
||||
@@ -106,6 +107,7 @@ export class ComponentManager
|
||||
|
||||
this.addSyncedComponentItemObserver()
|
||||
this.registerMobileNativeComponentUrls()
|
||||
this.registerDeprecatedEditorUrlsForAndroid()
|
||||
|
||||
this.eventDisposers.push(
|
||||
preferences.addEventObserver((event) => {
|
||||
@@ -292,6 +294,23 @@ export class ComponentManager
|
||||
}
|
||||
}
|
||||
|
||||
private registerDeprecatedEditorUrlsForAndroid(): void {
|
||||
if (!isMobileDevice(this.device)) {
|
||||
return
|
||||
}
|
||||
|
||||
const deprecatedEditors = [...GetDeprecatedEditors()]
|
||||
|
||||
for (const component of deprecatedEditors) {
|
||||
const feature = new UIFeature<ComponentFeatureDescription>(component)
|
||||
const url = this.urlForFeature(feature)
|
||||
|
||||
if (url) {
|
||||
this.device.registerComponentUrl(feature.uniqueIdentifier.value, url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
detectFocusChange = (): void => {
|
||||
const activeIframes = Array.from(document.getElementsByTagName('iframe'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user