EQMS-1326 Make drawing board readonly when editor is readonly (#7485)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-12-17 14:18:09 +07:00 committed by GitHub
parent 2158661df5
commit 4fa36837c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -31,6 +31,8 @@
const maxHeight = 1000
const minHeight = 100
$: readonly = !editor.isEditable || !selected
let savedBoard: SavedBoard
let resizer: HTMLElement
let startY: number
@ -137,7 +139,7 @@
savedCmds={savedBoard.commands}
savedProps={savedBoard.props}
resizeable={true}
readonly={!selected}
{readonly}
{loading}
{selected}
height={resizedHeight ?? node.attrs.height ?? defaultHeight}
@ -153,7 +155,7 @@
}}
/>
</div>
{#if selected}
{#if selected && !readonly}
<div
class="handle resizer"
bind:this={resizer}

View File

@ -22,6 +22,7 @@
export let savedCmds: YArray<DrawingCmd>
export let savedProps: YMap<any>
export let readonly = false
const dispatch = createEventDispatcher()
@ -41,6 +42,6 @@
dispatch('close')
}}
>
<DrawingBoardEditor {savedCmds} {savedProps} grabFocus />
<DrawingBoardEditor {savedCmds} {savedProps} {readonly} grabFocus />
</Dialog>
{/if}

View File

@ -38,7 +38,8 @@ export function showBoardPopup (board: SavedBoard, editor: Editor): void {
DrawingBoardPopup,
{
savedCmds: board.commands,
savedProps: board.props
savedProps: board.props,
readonly: !editor.isEditable
},
'centered',
() => {