mirror of
https://github.com/standardnotes/app.git
synced 2026-01-11 19:56:41 +00:00
feat: remove extensions manager (#696)
* feat: remove extensions manager * fix: remove unused code Co-authored-by: Aman Harwara <amanharwara@protonmail.com>
This commit is contained in:
parent
e79811afda
commit
8d9b192b81
17 changed files with 12 additions and 332 deletions
|
|
@ -9,12 +9,10 @@ SECRET_KEY_BASE=test
|
|||
APP_HOST=http://localhost:3001
|
||||
PURCHASE_URL=https://standardnotes.com/purchase
|
||||
|
||||
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
||||
SF_DEFAULT_SERVER=http://localhost:3000
|
||||
|
||||
# Development options
|
||||
DEV_DEFAULT_SYNC_SERVER=https://api.standardnotes.com
|
||||
DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html
|
||||
ENABLE_UNFINISHED_FEATURES=false
|
||||
DEV_WEBSOCKET_URL=wss://sockets-dev.standardnotes.com
|
||||
|
||||
|
|
|
|||
3
.github/workflows/beta.yml
vendored
3
.github/workflows/beta.yml
vendored
|
|
@ -31,9 +31,6 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Initiate submodules
|
||||
run: git submodule update --init
|
||||
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
|
|
|
|||
3
.github/workflows/dev.yml
vendored
3
.github/workflows/dev.yml
vendored
|
|
@ -35,9 +35,6 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Initiate submodules
|
||||
run: git submodule update --init
|
||||
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
|
|
|
|||
3
.github/workflows/prod.yml
vendored
3
.github/workflows/prod.yml
vendored
|
|
@ -35,9 +35,6 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Initiate submodules
|
||||
run: git submodule update --init
|
||||
|
||||
- name: Publish to Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
|
|
|
|||
10
.gitmodules
vendored
10
.gitmodules
vendored
|
|
@ -1,10 +0,0 @@
|
|||
[submodule "vendor/extensions/extensions-manager"]
|
||||
path = vendor/extensions/extensions-manager
|
||||
url = https://github.com/sn-extensions/extensions-manager.git
|
||||
[submodule "app/extensions/extensions-manager"]
|
||||
path = app/extensions/extensions-manager
|
||||
url = https://github.com/sn-extensions/extensions-manager.git
|
||||
[submodule "public/extensions/extensions-manager"]
|
||||
path = public/extensions/extensions-manager
|
||||
url = https://github.com/sn-extensions/extensions-manager.git
|
||||
|
||||
|
|
@ -107,6 +107,8 @@ GEM
|
|||
racc (~> 1.4)
|
||||
nokogiri (1.11.1-x64-mingw32)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.11.1-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
non-stupid-digest-assets (1.0.9)
|
||||
sprockets (>= 2.0)
|
||||
puma (4.3.5)
|
||||
|
|
@ -200,6 +202,7 @@ GEM
|
|||
PLATFORMS
|
||||
ruby
|
||||
x64-mingw32
|
||||
x86_64-darwin-18
|
||||
|
||||
DEPENDENCIES
|
||||
byebug
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -97,16 +97,6 @@ Then open your browser to `http://localhost:3001`.
|
|||
|
||||
---
|
||||
|
||||
**Extensions Manager and Batch Manager:**
|
||||
|
||||
The web app makes use of two optional native extensions, which, when running the app with Rails, can be configured to work as follows:
|
||||
|
||||
1. `git submodule update --init` (will load the submodules in the `public/extensions` folder)
|
||||
1. Set the following environment variables in the .env file:
|
||||
```
|
||||
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
||||
```
|
||||
|
||||
You can also set the `SF_DEFAULT_SERVER` environment variable to set the default server for login and registration.
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,118 +0,0 @@
|
|||
import { isDesktopApplication } from '@/utils';
|
||||
import {
|
||||
SNPredicate,
|
||||
ContentType,
|
||||
SNComponent,
|
||||
ApplicationService,
|
||||
ComponentAction,
|
||||
FillItemContent,
|
||||
ComponentMutator,
|
||||
Copy,
|
||||
PayloadContent,
|
||||
ComponentPermission } from '@standardnotes/snjs';
|
||||
|
||||
/** A class for handling installation of system extensions */
|
||||
export class NativeExtManager extends ApplicationService {
|
||||
extManagerId = 'org.standardnotes.extensions-manager';
|
||||
|
||||
/** @override */
|
||||
async onAppLaunch() {
|
||||
super.onAppLaunch();
|
||||
this.reload();
|
||||
}
|
||||
|
||||
get extManagerPred() {
|
||||
const extManagerId = 'org.standardnotes.extensions-manager';
|
||||
return SNPredicate.CompoundPredicate([
|
||||
new SNPredicate('content_type', '=', ContentType.Component),
|
||||
new SNPredicate('package_info.identifier', '=', extManagerId)
|
||||
]);
|
||||
}
|
||||
|
||||
get extMgrUrl() {
|
||||
return (window as any)._extensions_manager_location;
|
||||
}
|
||||
|
||||
reload() {
|
||||
this.application!.singletonManager!.registerPredicate(this.extManagerPred);
|
||||
this.resolveExtensionsManager();
|
||||
}
|
||||
|
||||
async resolveExtensionsManager() {
|
||||
const extensionsManager = (await this.application!.singletonManager!.findOrCreateSingleton(
|
||||
this.extManagerPred,
|
||||
ContentType.Component,
|
||||
this.extensionsManagerTemplateContent()
|
||||
)) as SNComponent;
|
||||
let needsSync = false;
|
||||
if (isDesktopApplication()) {
|
||||
if (!extensionsManager.local_url) {
|
||||
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
||||
const mutator = m as ComponentMutator;
|
||||
mutator.local_url = this.extMgrUrl;
|
||||
});
|
||||
needsSync = true;
|
||||
}
|
||||
} else {
|
||||
if (!extensionsManager.hosted_url) {
|
||||
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
||||
const mutator = m as ComponentMutator;
|
||||
mutator.hosted_url = this.extMgrUrl;
|
||||
});
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
// Handle addition of SN|ExtensionRepo permission
|
||||
const permissions = Copy(extensionsManager!.permissions) as ComponentPermission[];
|
||||
const permission = permissions.find((p) => {
|
||||
return p.name === ComponentAction.StreamItems;
|
||||
});
|
||||
if (permission && !permission.content_types!.includes(ContentType.ExtensionRepo)) {
|
||||
permission.content_types!.push(ContentType.ExtensionRepo);
|
||||
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
||||
const mutator = m as ComponentMutator;
|
||||
mutator.permissions = permissions;
|
||||
});
|
||||
needsSync = true;
|
||||
}
|
||||
if (needsSync) {
|
||||
this.application!.saveItem(extensionsManager.uuid);
|
||||
}
|
||||
}
|
||||
|
||||
extensionsManagerTemplateContent() {
|
||||
const url = this.extMgrUrl;
|
||||
if (!url) {
|
||||
throw Error('this.extMgrUrl must be set.');
|
||||
}
|
||||
const packageInfo = {
|
||||
name: 'Extensions',
|
||||
identifier: this.extManagerId
|
||||
};
|
||||
const content = FillItemContent({
|
||||
name: packageInfo.name,
|
||||
area: 'rooms',
|
||||
package_info: packageInfo,
|
||||
permissions: [
|
||||
{
|
||||
name: ComponentAction.StreamItems,
|
||||
content_types: [
|
||||
ContentType.Component,
|
||||
ContentType.Theme,
|
||||
ContentType.ServerExtension,
|
||||
ContentType.ActionsExtension,
|
||||
ContentType.Mfa,
|
||||
ContentType.Editor,
|
||||
ContentType.ExtensionRepo
|
||||
]
|
||||
}
|
||||
]
|
||||
}) as PayloadContent;
|
||||
if (isDesktopApplication()) {
|
||||
content.local_url = this.extMgrUrl;
|
||||
} else {
|
||||
content.hosted_url = this.extMgrUrl;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,6 @@ import { AutolockService } from '@/services/autolock_service';
|
|||
import { ArchiveManager } from '@/services/archiveManager';
|
||||
import { DesktopManager } from '@/services/desktopManager';
|
||||
import { IOService } from '@/services/ioService';
|
||||
import { NativeExtManager } from '@/services/nativeExtManager';
|
||||
import { StatusManager } from '@/services/statusManager';
|
||||
import { ThemeManager } from '@/services/themeManager';
|
||||
import { AppVersion } from '@/version';
|
||||
|
|
@ -32,7 +31,6 @@ type WebServices = {
|
|||
desktopService: DesktopManager;
|
||||
autolockService: AutolockService;
|
||||
archiveService: ArchiveManager;
|
||||
nativeExtService: NativeExtManager;
|
||||
statusManager: StatusManager;
|
||||
themeService: ThemeManager;
|
||||
io: IOService;
|
||||
|
|
@ -133,10 +131,6 @@ export class WebApplication extends SNApplication {
|
|||
return this.webServices.archiveService;
|
||||
}
|
||||
|
||||
public getNativeExtService() {
|
||||
return this.webServices.nativeExtService;
|
||||
}
|
||||
|
||||
getStatusManager() {
|
||||
return this.webServices.statusManager;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import { DesktopManager } from '@/services/desktopManager';
|
|||
import { IOService } from '@/services/ioService';
|
||||
import { AutolockService } from '@/services/autolock_service';
|
||||
import { StatusManager } from '@/services/statusManager';
|
||||
import { NativeExtManager } from '@/services/nativeExtManager';
|
||||
import { ThemeManager } from '@/services/themeManager';
|
||||
|
||||
export class ApplicationGroup extends SNApplicationGroup {
|
||||
|
|
@ -85,7 +84,6 @@ export class ApplicationGroup extends SNApplicationGroup {
|
|||
platform === Platform.MacWeb || platform === Platform.MacDesktop
|
||||
);
|
||||
const autolockService = new AutolockService(application);
|
||||
const nativeExtService = new NativeExtManager(application);
|
||||
const statusManager = new StatusManager();
|
||||
const themeService = new ThemeManager(application);
|
||||
application.setWebServices({
|
||||
|
|
@ -94,7 +92,6 @@ export class ApplicationGroup extends SNApplicationGroup {
|
|||
desktopService,
|
||||
io,
|
||||
autolockService,
|
||||
nativeExtService,
|
||||
statusManager,
|
||||
themeService,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,23 +39,6 @@
|
|||
app-state='ctrl.appState'
|
||||
application='ctrl.application'
|
||||
ng-if='ctrl.showQuickSettingsMenu',)
|
||||
.sk-app-bar-item
|
||||
a.no-decoration.sk-label.title(
|
||||
href='https://standardnotes.com/help',
|
||||
rel='noopener',
|
||||
target='_blank'
|
||||
)
|
||||
| Help
|
||||
.sk-app-bar-item.border
|
||||
.sk-app-bar-item(ng-repeat='room in ctrl.rooms track by room.uuid')
|
||||
.sk-app-bar-item-column(ng-click='ctrl.selectRoom(room)')
|
||||
.sk-label {{room.name}}
|
||||
component-modal(
|
||||
component-uuid='room.uuid',
|
||||
ng-if='ctrl.roomShowState[room.uuid]',
|
||||
on-dismiss='ctrl.onRoomDismiss(room)',
|
||||
application='ctrl.application'
|
||||
)
|
||||
.sk-app-bar-item.border(ng-if="ctrl.state.showBetaWarning")
|
||||
.sk-app-bar-item(ng-if="ctrl.state.showBetaWarning")
|
||||
a.no-decoration.sk-label.title(
|
||||
|
|
@ -89,21 +72,6 @@
|
|||
)
|
||||
.sk-app-bar-item(ng-if='ctrl.offline')
|
||||
.sk-label Offline
|
||||
.sk-app-bar-item.border(ng-if='ctrl.state.dockShortcuts.length > 0')
|
||||
.sk-app-bar-item.dock-shortcut(ng-repeat='shortcut in ctrl.state.dockShortcuts')
|
||||
.sk-app-bar-item-column(
|
||||
ng-class="{'underline': shortcut.component.active}",
|
||||
ng-click='ctrl.selectShortcut(shortcut)'
|
||||
)
|
||||
.div(ng-if="shortcut.icon.type == 'circle'" title='{{shortcut.name}}')
|
||||
.sk-circle.small(
|
||||
ng-style="{'background-color': shortcut.icon.background_color, 'border-color': shortcut.icon.border_color}"
|
||||
)
|
||||
.div(ng-if="shortcut.icon.type == 'svg'" title='{{shortcut.name}}')
|
||||
.svg-item(
|
||||
elem-ready='ctrl.initSvgForShortcut(shortcut)',
|
||||
ng-attr-id='dock-svg-{{shortcut.component.uuid}}'
|
||||
)
|
||||
.sk-app-bar-item.border(ng-if='ctrl.state.hasAccountSwitcher')
|
||||
.sk-app-bar-item(
|
||||
ng-if='ctrl.state.hasAccountSwitcher'
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { preventRefreshing } from '@/utils';
|
|||
import {
|
||||
ApplicationEvent,
|
||||
ContentType,
|
||||
SNComponent,
|
||||
SNTheme,
|
||||
ComponentArea,
|
||||
CollectionSort,
|
||||
|
|
@ -31,34 +30,21 @@ import { AccountMenuPane } from '@/components/AccountMenu';
|
|||
const ACCOUNT_SWITCHER_ENABLED = false;
|
||||
const ACCOUNT_SWITCHER_FEATURE_KEY = 'account_switcher';
|
||||
|
||||
type DockShortcut = {
|
||||
name: string;
|
||||
component: SNComponent;
|
||||
icon: {
|
||||
type: string;
|
||||
background_color: string;
|
||||
border_color: string;
|
||||
};
|
||||
};
|
||||
|
||||
class FooterViewCtrl extends PureViewCtrl<
|
||||
unknown,
|
||||
{
|
||||
outOfSync: boolean;
|
||||
hasPasscode: boolean;
|
||||
dataUpgradeAvailable: boolean;
|
||||
dockShortcuts: DockShortcut[];
|
||||
hasAccountSwitcher: boolean;
|
||||
showBetaWarning: boolean;
|
||||
showDataUpgrade: boolean;
|
||||
}
|
||||
> {
|
||||
private $rootScope: ng.IRootScopeService;
|
||||
private rooms: SNComponent[] = [];
|
||||
private themesWithIcons: SNTheme[] = [];
|
||||
private showSyncResolution = false;
|
||||
private unregisterComponent: any;
|
||||
private rootScopeListener1: any;
|
||||
private rootScopeListener2: any;
|
||||
public arbitraryStatusMessage?: string;
|
||||
public user?: any;
|
||||
|
|
@ -66,12 +52,8 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
public showAccountMenu = false;
|
||||
public showQuickSettingsMenu = false;
|
||||
private didCheckForOffline = false;
|
||||
private queueExtReload = false;
|
||||
private reloadInProgress = false;
|
||||
public hasError = false;
|
||||
public newUpdateAvailable = false;
|
||||
public dockShortcuts: DockShortcut[] = [];
|
||||
public roomShowState: Partial<Record<string, boolean>> = {};
|
||||
private observerRemovers: Array<() => void> = [];
|
||||
private completedInitialSync = false;
|
||||
private showingDownloadStatus = false;
|
||||
|
|
@ -92,16 +74,13 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
deinit() {
|
||||
for (const remove of this.observerRemovers) remove();
|
||||
this.observerRemovers.length = 0;
|
||||
this.rooms.length = 0;
|
||||
this.themesWithIcons.length = 0;
|
||||
this.unregisterComponent();
|
||||
this.unregisterComponent = undefined;
|
||||
this.rootScopeListener1();
|
||||
this.rootScopeListener2();
|
||||
this.rootScopeListener1 = undefined;
|
||||
this.rootScopeListener2 = undefined;
|
||||
(this.closeAccountMenu as any) = undefined;
|
||||
(this.toggleSyncResolutionMenu as any) = undefined;
|
||||
(this.closeAccountMenu as unknown) = undefined;
|
||||
(this.toggleSyncResolutionMenu as unknown) = undefined;
|
||||
super.deinit();
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +120,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
outOfSync: false,
|
||||
dataUpgradeAvailable: false,
|
||||
hasPasscode: false,
|
||||
dockShortcuts: [],
|
||||
descriptors: this.mainApplicationGroup.getDescriptors(),
|
||||
hasAccountSwitcher: false,
|
||||
showBetaWarning: false,
|
||||
|
|
@ -185,12 +163,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
}
|
||||
|
||||
addRootScopeListeners() {
|
||||
this.rootScopeListener1 = this.$rootScope.$on(
|
||||
RootScopeMessages.ReloadExtendedData,
|
||||
() => {
|
||||
this.reloadExtendedData();
|
||||
}
|
||||
);
|
||||
this.rootScopeListener2 = this.$rootScope.$on(
|
||||
RootScopeMessages.NewUpdateAvailable,
|
||||
() => {
|
||||
|
|
@ -207,7 +179,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
switch (eventName) {
|
||||
case AppStateEvent.EditorFocused:
|
||||
if (data.eventSource === EventSource.UserInteraction) {
|
||||
this.closeAllRooms();
|
||||
this.closeAccountMenu();
|
||||
}
|
||||
break;
|
||||
|
|
@ -303,37 +274,21 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
}
|
||||
);
|
||||
|
||||
this.observerRemovers.push(
|
||||
this.application.streamItems(ContentType.Component, async () => {
|
||||
const components = this.application.getItems(
|
||||
ContentType.Component
|
||||
) as SNComponent[];
|
||||
this.rooms = components.filter((candidate) => {
|
||||
return candidate.area === ComponentArea.Rooms && !candidate.deleted;
|
||||
});
|
||||
if (this.queueExtReload) {
|
||||
this.queueExtReload = false;
|
||||
this.reloadExtendedData();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
this.observerRemovers.push(
|
||||
this.application.streamItems(ContentType.Theme, async () => {
|
||||
const themes = this.application.getDisplayableItems(
|
||||
ContentType.Theme
|
||||
) as SNTheme[];
|
||||
this.themesWithIcons = themes;
|
||||
this.reloadDockShortcuts();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
registerComponentHandler() {
|
||||
this.unregisterComponent =
|
||||
this.application.componentManager!.registerHandler({
|
||||
this.application.componentManager.registerHandler({
|
||||
identifier: 'room-bar',
|
||||
areas: [ComponentArea.Rooms, ComponentArea.Modal],
|
||||
areas: [ComponentArea.Modal],
|
||||
focusHandler: (component, focused) => {
|
||||
if (component.isEditor() && focused) {
|
||||
if (
|
||||
|
|
@ -342,7 +297,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
) {
|
||||
return;
|
||||
}
|
||||
this.closeAllRooms();
|
||||
this.closeAccountMenu();
|
||||
}
|
||||
},
|
||||
|
|
@ -351,7 +305,7 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
|
||||
updateSyncStatus() {
|
||||
const statusManager = this.application.getStatusManager();
|
||||
const syncStatus = this.application!.getSyncStatus();
|
||||
const syncStatus = this.application.getSyncStatus();
|
||||
const stats = syncStatus.getStats();
|
||||
if (syncStatus.hasError()) {
|
||||
statusManager.setMessage('Unable to Sync');
|
||||
|
|
@ -385,9 +339,9 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
|
||||
updateLocalDataStatus() {
|
||||
const statusManager = this.application.getStatusManager();
|
||||
const syncStatus = this.application!.getSyncStatus();
|
||||
const syncStatus = this.application.getSyncStatus();
|
||||
const stats = syncStatus.getStats();
|
||||
const encryption = this.application!.isEncryptionAvailable();
|
||||
const encryption = this.application.isEncryptionAvailable();
|
||||
if (stats.localDataDone) {
|
||||
statusManager.setMessage('');
|
||||
return;
|
||||
|
|
@ -399,35 +353,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
statusManager.setMessage(loadingStatus);
|
||||
}
|
||||
|
||||
reloadExtendedData() {
|
||||
if (this.reloadInProgress) {
|
||||
return;
|
||||
}
|
||||
this.reloadInProgress = true;
|
||||
|
||||
/**
|
||||
* A reload consists of opening the extensions manager,
|
||||
* then closing it after a short delay.
|
||||
*/
|
||||
const extWindow = this.rooms.find((room) => {
|
||||
return (
|
||||
room.package_info.identifier ===
|
||||
this.application.getNativeExtService().extManagerId
|
||||
);
|
||||
});
|
||||
if (!extWindow) {
|
||||
this.queueExtReload = true;
|
||||
this.reloadInProgress = false;
|
||||
return;
|
||||
}
|
||||
this.selectRoom(extWindow);
|
||||
this.$timeout(() => {
|
||||
this.selectRoom(extWindow);
|
||||
this.reloadInProgress = false;
|
||||
this.$rootScope.$broadcast('ext-reload-complete');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
updateOfflineStatus() {
|
||||
this.offline = this.application.noAccount();
|
||||
}
|
||||
|
|
@ -453,7 +378,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
accountMenuPressed() {
|
||||
this.appState.quickSettingsMenu.closeQuickSettingsMenu();
|
||||
this.appState.accountMenu.toggleShow();
|
||||
this.closeAllRooms();
|
||||
}
|
||||
|
||||
quickSettingsPressed() {
|
||||
|
|
@ -463,7 +387,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
} else {
|
||||
this.appState.preferences.openPreferences();
|
||||
}
|
||||
this.closeAllRooms();
|
||||
}
|
||||
|
||||
toggleSyncResolutionMenu() {
|
||||
|
|
@ -485,56 +408,7 @@ class FooterViewCtrl extends PureViewCtrl<
|
|||
|
||||
clickedNewUpdateAnnouncement() {
|
||||
this.newUpdateAvailable = false;
|
||||
this.application.alertService!.alert(STRING_NEW_UPDATE_READY);
|
||||
}
|
||||
|
||||
reloadDockShortcuts() {
|
||||
const shortcuts: DockShortcut[] = [];
|
||||
this.setState({
|
||||
dockShortcuts: shortcuts.sort((a, b) => {
|
||||
/** Circles first, then images */
|
||||
const aType = a.icon.type;
|
||||
const bType = b.icon.type;
|
||||
if (aType === 'circle' && bType === 'svg') {
|
||||
return -1;
|
||||
} else if (bType === 'circle' && aType === 'svg') {
|
||||
return 1;
|
||||
} else {
|
||||
return a.name.localeCompare(b.name);
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
initSvgForShortcut(shortcut: DockShortcut) {
|
||||
const id = 'dock-svg-' + shortcut.component.uuid;
|
||||
const element = document.getElementById(id)!;
|
||||
const parser = new DOMParser();
|
||||
const svg = shortcut.component.package_info.dock_icon?.source;
|
||||
if (svg != undefined) {
|
||||
const doc = parser.parseFromString(svg, 'image/svg+xml');
|
||||
element.appendChild(doc.documentElement);
|
||||
}
|
||||
}
|
||||
|
||||
selectShortcut(shortcut: DockShortcut) {
|
||||
this.application.toggleComponent(shortcut.component);
|
||||
}
|
||||
|
||||
onRoomDismiss(room: SNComponent) {
|
||||
this.roomShowState[room.uuid] = false;
|
||||
}
|
||||
|
||||
closeAllRooms() {
|
||||
for (const room of this.rooms) {
|
||||
this.roomShowState[room.uuid] = false;
|
||||
}
|
||||
}
|
||||
|
||||
async selectRoom(room: SNComponent) {
|
||||
this.$timeout(() => {
|
||||
this.roomShowState[room.uuid] = !this.roomShowState[room.uuid];
|
||||
});
|
||||
this.application.alertService.alert(STRING_NEW_UPDATE_READY);
|
||||
}
|
||||
|
||||
displayBetaDialog() {
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 81642c6e4ee0ae8232732b8763e9bed91badce23
|
||||
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
<script>
|
||||
window._default_sync_server = "<%= ENV['SF_DEFAULT_SERVER'] %>";
|
||||
window._extensions_manager_location = "<%= ENV['EXTENSIONS_MANAGER_LOCATION'] %>";
|
||||
window._batch_manager_location = "<%= ENV['BATCH_MANAGER_LOCATION'] %>";
|
||||
window._bugsnag_api_key = "<%= ENV['BUGSNAG_API_KEY'] %>";
|
||||
window._enable_unfinished_features = "<%= ENV['ENABLE_UNFINISHED_FEATURES'] %>" === 'true';
|
||||
window._websocket_url = "<%= ENV['WEBSOCKET_URL'] %>";
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
<body
|
||||
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
|
||||
data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>"
|
||||
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
|
||||
data-enable-unfinished-features="<%= env.ENABLE_UNFINISHED_FEATURES %>"
|
||||
data-web-socket-url="<%= env.DEV_WEBSOCKET_URL %>"
|
||||
|
|
@ -38,7 +37,6 @@
|
|||
>
|
||||
<script>
|
||||
window._default_sync_server = document.body.dataset.defaultSyncServer || "https://api.standardnotes.com";
|
||||
window._extensions_manager_location = document.body.dataset.extensionsManagerLocation || "public/extensions/extensions-manager/dist/index.html";
|
||||
window._bugsnag_api_key = document.body.dataset.bugsnagApiKey;
|
||||
window._enable_unfinished_features = document.body.dataset.enableUnfinishedFeatures === 'true';
|
||||
window._websocket_url = document.body.dataset.webSocketUrl;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"url": "https://github.com/standardnotes/web"
|
||||
},
|
||||
"scripts": {
|
||||
"setup": "yarn submodules && yarn install",
|
||||
"setup": "yarn install",
|
||||
"start": "webpack-dev-server --config webpack.dev.js",
|
||||
"watch": "webpack -w --config webpack.dev.js",
|
||||
"watch:desktop": "webpack -w --config webpack.dev.js --env.platform='desktop'",
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
"bundle:desktop": "webpack --config webpack.prod.js --env.platform='desktop'",
|
||||
"bundle:desktop:beta": "webpack --config webpack.prod.js --env.platform='desktop' --env.public_beta='true'",
|
||||
"build": "bundle install && yarn install --frozen-lockfile && bundle exec rails assets:precompile && yarn bundle",
|
||||
"submodules": "git submodule update --init --force",
|
||||
"lint": "eslint --fix app/assets/javascripts",
|
||||
"tsc": "tsc --project app/assets/javascripts/tsconfig.json"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 81642c6e4ee0ae8232732b8763e9bed91badce23
|
||||
Loading…
Add table
Reference in a new issue