mirror of https://github.com/logseq/logseq
fix: do not deselect shapes
parent
273c8563ed
commit
e9d71cc217
|
@ -145,7 +145,7 @@ export default function App() {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
setModel(onLoad())
|
setModel(onLoad())
|
||||||
}, 5000)
|
}, 2000)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
|
|
|
@ -33,16 +33,6 @@ export default defineConfig({
|
||||||
find: 'tldraw-logseq',
|
find: 'tldraw-logseq',
|
||||||
replacement: bases.tldrawLogseq,
|
replacement: bases.tldrawLogseq,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
find: /~(.*)/,
|
|
||||||
replacement: '$1',
|
|
||||||
customResolver: (id, importer) => {
|
|
||||||
if (id) {
|
|
||||||
const base = Object.values(bases).find(value => importer.startsWith(value))
|
|
||||||
return base ? path.join('/@fs', base, id) : null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
find: '@tldraw/core',
|
find: '@tldraw/core',
|
||||||
replacement: bases.core,
|
replacement: bases.core,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { computed, makeObservable, transaction } from 'mobx'
|
import { computed, makeObservable, transaction } from 'mobx'
|
||||||
import type { TLEventMap } from '../types'
|
import type { TLEventMap } from '../types'
|
||||||
import { deepEqual } from '../utils'
|
import { dedupe, deepEqual } from '../utils'
|
||||||
import type { TLShape } from './shapes'
|
import type { TLShape } from './shapes'
|
||||||
import type { TLApp, TLDocumentModel } from './TLApp'
|
import type { TLApp, TLDocumentModel } from './TLApp'
|
||||||
import { TLPage } from './TLPage'
|
import { TLPage } from './TLPage'
|
||||||
|
@ -94,12 +94,11 @@ export class TLHistory<S extends TLShape = TLShape, K extends TLEventMap = TLEve
|
||||||
|
|
||||||
deserialize = (snapshot: TLDocumentModel) => {
|
deserialize = (snapshot: TLDocumentModel) => {
|
||||||
transaction(() => {
|
transaction(() => {
|
||||||
const { currentPageId, selectedIds, pages } = snapshot
|
const { selectedIds, pages } = snapshot
|
||||||
const wasPaused = this.isPaused
|
const wasPaused = this.isPaused
|
||||||
this.pause()
|
this.pause()
|
||||||
|
|
||||||
const newSelectedIds =
|
const newSelectedIds = dedupe([...this.app.selectedIds, ...selectedIds])
|
||||||
selectedIds.length === 0 ? Array.from(this.app.selectedIds) : selectedIds
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const pagesMap = new Map(this.app.pages)
|
const pagesMap = new Map(this.app.pages)
|
||||||
|
|
|
@ -70,6 +70,7 @@ export class TLPage<S extends TLShape = TLShape, E extends TLEventMap = TLEventM
|
||||||
.map(s => toJS(s)),
|
.map(s => toJS(s)),
|
||||||
bindings: deepCopy(this.bindings),
|
bindings: deepCopy(this.bindings),
|
||||||
nonce: this.nonce,
|
nonce: this.nonce,
|
||||||
|
selectedIds: deepCopy(this.app.selectedIds),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,10 @@ export function debounce<T extends (...args: any[]) => void>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function dedupe<T>(arr: T[]) {
|
||||||
|
return [...new Set(arr)]
|
||||||
|
}
|
||||||
|
|
||||||
/** Linear interpolate between two values. */
|
/** Linear interpolate between two values. */
|
||||||
export function lerp(a: number, b: number, t: number) {
|
export function lerp(a: number, b: number, t: number) {
|
||||||
return a + (b - a) * t
|
return a + (b - a) * t
|
||||||
|
|
Loading…
Reference in New Issue