rename app to editor (#1503)
This PR renames `App`, `app` and all appy names to `Editor`, `editor`, and editorry names. ### Change Type - [x] `major` — Breaking Change ### Release Notes - Rename `App` to `Editor` and many other things that reference `app` to `editor`.
This commit is contained in:
parent
640bc9de24
commit
735f1c41b7
311 changed files with 8365 additions and 8209 deletions
|
@ -1,4 +1,4 @@
|
|||
import { App, TLNullableShapeProps, TLStyleItem, useApp } from '@tldraw/editor'
|
||||
import { Editor, TLNullableShapeProps, TLStyleItem, useEditor } from '@tldraw/editor'
|
||||
import React, { useCallback } from 'react'
|
||||
|
||||
import { useValue } from 'signia-react'
|
||||
|
@ -15,15 +15,15 @@ interface StylePanelProps {
|
|||
|
||||
/** @public */
|
||||
export const StylePanel = function StylePanel({ isMobile }: StylePanelProps) {
|
||||
const app = useApp()
|
||||
const editor = useEditor()
|
||||
|
||||
const props = useValue('props', () => app.props, [app])
|
||||
const props = useValue('props', () => editor.props, [editor])
|
||||
|
||||
const handlePointerOut = useCallback(() => {
|
||||
if (!isMobile) {
|
||||
app.isChangingStyle = false
|
||||
editor.isChangingStyle = false
|
||||
}
|
||||
}, [app, isMobile])
|
||||
}, [editor, isMobile])
|
||||
|
||||
if (!props) return null
|
||||
|
||||
|
@ -49,24 +49,24 @@ export const StylePanel = function StylePanel({ isMobile }: StylePanelProps) {
|
|||
)
|
||||
}
|
||||
|
||||
const { styles } = App
|
||||
const { styles } = Editor
|
||||
|
||||
function useStyleChangeCallback() {
|
||||
const app = useApp()
|
||||
const editor = useEditor()
|
||||
|
||||
return React.useCallback(
|
||||
(item: TLStyleItem, squashing: boolean) => {
|
||||
app.batch(() => {
|
||||
app.setProp(item.type, item.id, false, squashing)
|
||||
app.isChangingStyle = true
|
||||
editor.batch(() => {
|
||||
editor.setProp(item.type, item.id, false, squashing)
|
||||
editor.isChangingStyle = true
|
||||
})
|
||||
},
|
||||
[app]
|
||||
[editor]
|
||||
)
|
||||
}
|
||||
|
||||
function CommonStylePickerSet({ props }: { props: TLNullableShapeProps }) {
|
||||
const app = useApp()
|
||||
const editor = useEditor()
|
||||
const msg = useTranslation()
|
||||
|
||||
const handleValueChange = useStyleChangeCallback()
|
||||
|
@ -74,10 +74,10 @@ function CommonStylePickerSet({ props }: { props: TLNullableShapeProps }) {
|
|||
const handleOpacityValueChange = React.useCallback(
|
||||
(value: number, ephemeral: boolean) => {
|
||||
const item = styles.opacity[value]
|
||||
app.setProp(item.type, item.id, ephemeral)
|
||||
app.isChangingStyle = true
|
||||
editor.setProp(item.type, item.id, ephemeral)
|
||||
editor.isChangingStyle = true
|
||||
},
|
||||
[app]
|
||||
[editor]
|
||||
)
|
||||
|
||||
const { color, fill, dash, size, opacity } = props
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue