Compare commits

...
Author SHA1 Message Date
StandardNotes CI 8362c4e92c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].2
2023-06-25 18:50:31 +00:00
Aman Harwara b8481dfbe3 Merge branch 'main' of github.com:standardnotes/app 2023-06-25 23:53:31 +05:30
Aman Harwara 046eaac548 refactor: packageprovider 2023-06-25 23:53:23 +05:30
StandardNotes CI 747ba1b342 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
 - @standardnotes/[email protected].1
2023-06-25 12:46:27 +00:00
Aman Harwara 7c3b8d4534 chore: fix test 2023-06-25 17:47:35 +05:30
Aman Harwara 0613436198 chore: select current result when closing super search dialog 2023-06-25 16:37:05 +05:30
Aman Harwara 63b95391a6 refactor: use actual maps for uuidmap 2023-06-25 16:14:52 +05:30
Aman Harwara 195420101a chore: fix conflict map addition/removal 2023-06-25 16:05:50 +05:30
35 changed files with 226 additions and 70 deletions
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.26.13](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/api
## [1.26.12](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/api
## [1.26.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/api
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api",
"version": "1.26.11",
"version": "1.26.13",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.50](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.49](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.48](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/clipper
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@standardnotes/clipper",
"description": "Web clipper browser extension for Standard Notes",
"version": "1.1.48",
"version": "1.1.50",
"private": true,
"scripts": {
"build-mv2": "yarn clean && webpack --config ./webpack.config.prod.js",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.106.59](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/desktop
## [3.106.58](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/desktop
## [3.106.57](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/desktop
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@standardnotes/desktop",
"main": "./app/dist/index.js",
"version": "3.106.57",
"version": "3.106.59",
"license": "AGPL-3.0-or-later",
"author": "Standard Notes.",
"private": true,
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.21.41](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/encryption
## [1.21.40](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/encryption
## [1.21.39](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/encryption
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/encryption",
"version": "1.21.39",
"version": "1.21.41",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.50](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/filepicker
## [1.28.49](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/filepicker
## [1.28.48](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/filepicker
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/filepicker",
"version": "1.28.48",
"version": "1.28.50",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.15.12](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/files
## [1.15.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/files
## [1.15.10](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/files
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files",
"version": "1.15.10",
"version": "1.15.12",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.53.59](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/mobile
## [3.53.58](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/mobile
## [3.53.57](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/mobile
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/mobile",
"version": "3.53.57",
"version": "3.53.59",
"author": "Standard Notes.",
"private": true,
"license": "AGPL-3.0-or-later",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.46.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/models
## [1.46.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/models
# [1.46.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
### Features
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/models",
"version": "1.46.0",
"version": "1.46.2",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -187,7 +187,16 @@ export abstract class Collection<
const conflictOf = element.content.conflict_of
if (conflictOf) {
this.conflictMap.establishRelationship(conflictOf, element.uuid)
} else if (this.conflictMap.getInverseRelationships(element.uuid).length > 0) {
}
const isInConflictMapButIsNotConflictOf =
!conflictOf && this.conflictMap.getInverseRelationships(element.uuid).length > 0
const isInConflictMapButDoesNotHaveConflicts =
this.conflictMap.existsInDirectMap(element.uuid) &&
this.conflictMap.getDirectRelationships(element.uuid).length === 0
if (isInConflictMapButIsNotConflictOf || isInConflictMapButDoesNotHaveConflicts) {
this.conflictMap.removeFromMap(element.uuid)
}
@@ -205,7 +214,7 @@ export abstract class Collection<
if (element.deleted) {
this.nondeletedIndex.delete(element.uuid)
if (this.conflictMap.getInverseRelationships(element.uuid).length > 0) {
if (this.conflictMap.existsInDirectMap(element.uuid) || this.conflictMap.existsInInverseMap(element.uuid)) {
this.conflictMap.removeFromMap(element.uuid)
}
} else {
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.327](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.326](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.325](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/releases
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/releases",
"version": "1.4.325",
"version": "1.4.327",
"license": "AGPL-3.0-or-later",
"main": "dist/releases.json",
"types": "dist/index.d.ts",
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.60.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/services
## [1.60.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/services
# [1.60.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
### Features
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/services",
"version": "1.60.0",
"version": "1.60.2",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.169.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/snjs
## [2.169.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/snjs
# [2.169.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
### Features
+7 -7
View File
@@ -82,14 +82,14 @@ describe('item manager', function () {
const note = await this.createNote()
const tag = await this.createTag([note])
expect(this.itemManager.collection.referenceMap.directMap[tag.uuid]).to.eql([note.uuid])
expect(this.itemManager.collection.referenceMap.directMap.get(tag.uuid)).to.eql([note.uuid])
})
it('inverse reference map', async function () {
const note = await this.createNote()
const tag = await this.createTag([note])
expect(this.itemManager.collection.referenceMap.inverseMap[note.uuid]).to.eql([tag.uuid])
expect(this.itemManager.collection.referenceMap.inverseMap.get(note.uuid)).to.eql([tag.uuid])
})
it('inverse reference map should not have duplicates', async function () {
@@ -97,7 +97,7 @@ describe('item manager', function () {
const tag = await this.createTag([note])
await this.itemManager.changeItem(tag)
expect(this.itemManager.collection.referenceMap.inverseMap[note.uuid]).to.eql([tag.uuid])
expect(this.itemManager.collection.referenceMap.inverseMap.get(note.uuid)).to.eql([tag.uuid])
})
it('deleting from reference map', async function () {
@@ -105,8 +105,8 @@ describe('item manager', function () {
const tag = await this.createTag([note])
await this.itemManager.setItemToBeDeleted(note)
expect(this.itemManager.collection.referenceMap.directMap[tag.uuid]).to.eql([])
expect(this.itemManager.collection.referenceMap.inverseMap[note.uuid].length).to.equal(0)
expect(this.itemManager.collection.referenceMap.directMap.get(tag.uuid)).to.eql([])
expect(this.itemManager.collection.referenceMap.inverseMap.get(note.uuid).length).to.equal(0)
})
it('deleting referenced item should update referencing item references', async function () {
@@ -125,8 +125,8 @@ describe('item manager', function () {
mutator.removeItemAsRelationship(note)
})
expect(this.itemManager.collection.referenceMap.directMap[tag.uuid]).to.eql([])
expect(this.itemManager.collection.referenceMap.inverseMap[note.uuid]).to.eql([])
expect(this.itemManager.collection.referenceMap.directMap.get(tag.uuid)).to.eql([])
expect(this.itemManager.collection.referenceMap.inverseMap.get(note.uuid)).to.eql([])
})
it('emitting discardable payload should remove it from our collection', async function () {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/snjs",
"version": "2.169.0",
"version": "2.169.2",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.26.17](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/ui-services
## [1.26.16](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/ui-services
## [1.26.15](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/ui-services
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/ui-services",
"version": "1.26.15",
"version": "1.26.17",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.17.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/utils
## [1.17.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/utils
# [1.17.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
### Features
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/utils",
"version": "1.17.0",
"version": "1.17.2",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+32 -24
View File
@@ -6,31 +6,39 @@ import { addIfUnique, removeFromArray } from '../Utils/Utils'
*/
export class UuidMap {
/** uuid to uuids that we have a relationship with */
private directMap: Partial<Record<string, string[]>> = {}
private directMap: Map<string, string[]> = new Map()
/** uuid to uuids that have a relationship with us */
private inverseMap: Partial<Record<string, string[]>> = {}
private inverseMap: Map<string, string[]> = new Map()
public get directMapSize(): number {
return Object.keys(this.directMap).length
return this.directMap.size
}
public get inverseMapSize(): number {
return Object.keys(this.inverseMap).length
return this.inverseMap.size
}
public makeCopy(): UuidMap {
const copy = new UuidMap()
copy.directMap = Object.assign({}, this.directMap)
copy.inverseMap = Object.assign({}, this.inverseMap)
copy.directMap = new Map(this.directMap)
copy.inverseMap = new Map(this.inverseMap)
return copy
}
public existsInDirectMap(uuid: string): boolean {
return this.directMap.has(uuid)
}
public existsInInverseMap(uuid: string): boolean {
return this.inverseMap.has(uuid)
}
public getDirectRelationships(uuid: string): string[] {
return this.directMap[uuid] || []
return this.directMap.get(uuid) || []
}
public getInverseRelationships(uuid: string): string[] {
return this.inverseMap[uuid] || []
return this.inverseMap.get(uuid) || []
}
public establishRelationship(uuidA: string, uuidB: string): void {
@@ -44,8 +52,8 @@ export class UuidMap {
}
public setAllRelationships(uuid: string, relationships: string[]): void {
const previousDirect = this.directMap[uuid] || []
this.directMap[uuid] = relationships
const previousDirect = this.directMap.get(uuid) || []
this.directMap.set(uuid, relationships)
/** Remove all previous values in case relationships have changed
* The updated references will be added afterwards.
@@ -62,41 +70,41 @@ export class UuidMap {
public removeFromMap(uuid: string): void {
/** Items that we reference */
const directReferences = this.directMap[uuid] || []
const directReferences = this.directMap.get(uuid) || []
for (const directReference of directReferences) {
removeFromArray(this.inverseMap[directReference] || [], uuid)
removeFromArray(this.inverseMap.get(directReference) || [], uuid)
}
delete this.directMap[uuid]
this.directMap.delete(uuid)
/** Items that are referencing us */
const inverseReferences = this.inverseMap[uuid] || []
const inverseReferences = this.inverseMap.get(uuid) || []
for (const inverseReference of inverseReferences) {
removeFromArray(this.directMap[inverseReference] || [], uuid)
removeFromArray(this.directMap.get(inverseReference) || [], uuid)
}
delete this.inverseMap[uuid]
this.inverseMap.delete(uuid)
}
private establishDirectRelationship(uuidA: string, uuidB: string): void {
const index = this.directMap[uuidA] || []
const index = this.directMap.get(uuidA) || []
addIfUnique(index, uuidB)
this.directMap[uuidA] = index
this.directMap.set(uuidA, index)
}
private establishInverseRelationship(uuidA: string, uuidB: string): void {
const inverseIndex = this.inverseMap[uuidB] || []
const inverseIndex = this.inverseMap.get(uuidB) || []
addIfUnique(inverseIndex, uuidA)
this.inverseMap[uuidB] = inverseIndex
this.inverseMap.set(uuidB, inverseIndex)
}
private deestablishDirectRelationship(uuidA: string, uuidB: string): void {
const index = this.directMap[uuidA] || []
const index = this.directMap.get(uuidA) || []
removeFromArray(index, uuidB)
this.directMap[uuidA] = index
this.directMap.set(uuidA, index)
}
private deestablishInverseRelationship(uuidA: string, uuidB: string): void {
const inverseIndex = this.inverseMap[uuidB] || []
const inverseIndex = this.inverseMap.get(uuidB) || []
removeFromArray(inverseIndex, uuidA)
this.inverseMap[uuidB] = inverseIndex
this.inverseMap.set(uuidB, inverseIndex)
}
}
+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.162.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/web
## [3.162.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
**Note:** Version bump only for package @standardnotes/web
# [3.162.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)
### Features
+22
View File
@@ -1,5 +1,27 @@
{
"versions": [
{
"version": "3.162.2",
"title": "[3.162.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.162.1",
"title": "[3.162.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.162.0",
"title": "[3.162.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-06-25)",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/web",
"version": "3.162.0",
"version": "3.162.2",
"license": "AGPL-3.0-or-later",
"main": "dist/app.js",
"author": "Standard Notes",
@@ -1,19 +1,14 @@
import { WebApplication } from '@/Application/WebApplication'
import { ClientDisplayableError, FeatureDescription } from '@standardnotes/snjs'
import { GetFeatures } from '@standardnotes/snjs'
import { makeAutoObservable, observable } from 'mobx'
import { AnyPackageType } from '../Types/AnyPackageType'
export class PackageProvider {
static async load(application: WebApplication): Promise<PackageProvider | undefined> {
const response = await application.getAvailableSubscriptions()
if (!response || response instanceof ClientDisplayableError) {
return undefined
}
static async load(): Promise<PackageProvider | undefined> {
const versionMap: Map<string, string> = new Map()
collectFeatures(response.PLUS_PLAN?.features as FeatureDescription[], versionMap)
collectFeatures(response.PRO_PLAN?.features as FeatureDescription[], versionMap)
GetFeatures().forEach((feature) => {
versionMap.set(feature.identifier, 'Latest')
})
return new PackageProvider(versionMap)
}
@@ -28,13 +23,3 @@ export class PackageProvider {
return this.latestVersionsMap.get(extension.package_info.identifier)
}
}
function collectFeatures(features: FeatureDescription[] | undefined, versionMap: Map<string, string>) {
if (features == undefined) {
return
}
for (const feature of features) {
versionMap.set(feature.identifier, 'Latest')
}
}
@@ -67,7 +67,7 @@ export class PreferencesMenu {
}
private loadLatestVersions(): void {
PackageProvider.load(this.application)
PackageProvider.load()
.then((versions) => {
if (versions) {
this._extensionLatestVersions = versions
@@ -1,5 +1,5 @@
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { $getNearestNodeFromDOMNode, TextNode } from 'lexical'
import { $getNearestNodeFromDOMNode, TextNode, $createRangeSelection, $setSelection, $isTextNode } from 'lexical'
import { useCallback, useEffect, useLayoutEffect, useMemo } from 'react'
import { createSearchHighlightElement } from './createSearchHighlightElement'
import { useSuperSearchContext } from './Context'
@@ -285,11 +285,31 @@ export const SearchPlugin = () => {
}
}, [editor])
const selectCurrentResult = useCallback(() => {
if (results.length === 0) {
return
}
const result = results[currentResultIndex]
if (!result) {
return
}
editor.update(() => {
const rangeSelection = $createRangeSelection()
$setSelection(rangeSelection)
const lexicalNode = $getNearestNodeFromDOMNode(result.node)
if ($isTextNode(lexicalNode)) {
lexicalNode.select(result.startIndex, result.endIndex)
}
})
}, [currentResultIndex, editor, results])
return (
<>
<SearchDialog
open={isSearchActive}
closeDialog={() => {
selectCurrentResult()
dispatch({ type: 'toggle-search' })
dispatch({ type: 'reset-search' })
editor.focus()