feat: add zone change listener
This commit is contained in:
@@ -7,7 +7,8 @@ import {
|
|||||||
IPageSizeChange,
|
IPageSizeChange,
|
||||||
IRangeStyleChange,
|
IRangeStyleChange,
|
||||||
ISaved,
|
ISaved,
|
||||||
IVisiblePageNoListChange
|
IVisiblePageNoListChange,
|
||||||
|
IZoneChange
|
||||||
} from '../../interface/Listener'
|
} from '../../interface/Listener'
|
||||||
|
|
||||||
export class Listener {
|
export class Listener {
|
||||||
@@ -21,6 +22,7 @@ export class Listener {
|
|||||||
public contentChange: IContentChange | null
|
public contentChange: IContentChange | null
|
||||||
public controlChange: IControlChange | null
|
public controlChange: IControlChange | null
|
||||||
public pageModeChange: IPageModeChange | null
|
public pageModeChange: IPageModeChange | null
|
||||||
|
public zoneChange: IZoneChange | null
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.rangeStyleChange = null
|
this.rangeStyleChange = null
|
||||||
@@ -32,6 +34,7 @@ export class Listener {
|
|||||||
this.contentChange = null
|
this.contentChange = null
|
||||||
this.controlChange = null
|
this.controlChange = null
|
||||||
this.pageModeChange = null
|
this.pageModeChange = null
|
||||||
|
this.zoneChange = null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { EDITOR_PREFIX } from '../../dataset/constant/Editor'
|
import { EDITOR_PREFIX } from '../../dataset/constant/Editor'
|
||||||
import { EditorZone } from '../../dataset/enum/Editor'
|
import { EditorZone } from '../../dataset/enum/Editor'
|
||||||
import { IEditorOption } from '../../interface/Editor'
|
import { IEditorOption } from '../../interface/Editor'
|
||||||
|
import { nextTick } from '../../utils'
|
||||||
import { Draw } from '../draw/Draw'
|
import { Draw } from '../draw/Draw'
|
||||||
import { I18n } from '../i18n/I18n'
|
import { I18n } from '../i18n/I18n'
|
||||||
|
|
||||||
@@ -53,6 +54,13 @@ export class Zone {
|
|||||||
})
|
})
|
||||||
// 指示器
|
// 指示器
|
||||||
this.drawZoneIndicator()
|
this.drawZoneIndicator()
|
||||||
|
// 回调
|
||||||
|
nextTick(() => {
|
||||||
|
const listener = this.draw.getListener()
|
||||||
|
if (listener.zoneChange) {
|
||||||
|
listener.zoneChange(payload)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public drawZoneIndicator() {
|
public drawZoneIndicator() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ElementType, PageMode } from '..'
|
import { EditorZone, ElementType, PageMode } from '..'
|
||||||
import { RowFlex } from '../dataset/enum/Row'
|
import { RowFlex } from '../dataset/enum/Row'
|
||||||
import { IControl } from './Control'
|
import { IControl } from './Control'
|
||||||
import { IEditorResult } from './Editor'
|
import { IEditorResult } from './Editor'
|
||||||
@@ -37,4 +37,6 @@ export type IContentChange = () => void
|
|||||||
|
|
||||||
export type IControlChange = (payload: IControl | null) => void
|
export type IControlChange = (payload: IControl | null) => void
|
||||||
|
|
||||||
export type IPageModeChange = (payload: PageMode) => void
|
export type IPageModeChange = (payload: PageMode) => void
|
||||||
|
|
||||||
|
export type IZoneChange = (payload: EditorZone) => void
|
||||||
Reference in New Issue
Block a user