feat:get range text command
This commit is contained in:
@@ -68,6 +68,7 @@ export class Command {
|
|||||||
private static getImage: CommandAdapt['getImage']
|
private static getImage: CommandAdapt['getImage']
|
||||||
private static getValue: CommandAdapt['getValue']
|
private static getValue: CommandAdapt['getValue']
|
||||||
private static getWordCount: CommandAdapt['getWordCount']
|
private static getWordCount: CommandAdapt['getWordCount']
|
||||||
|
private static getRangeText: CommandAdapt['getRangeText']
|
||||||
private static pageMode: CommandAdapt['pageMode']
|
private static pageMode: CommandAdapt['pageMode']
|
||||||
private static pageScaleRecovery: CommandAdapt['pageScaleRecovery']
|
private static pageScaleRecovery: CommandAdapt['pageScaleRecovery']
|
||||||
private static pageScaleMinus: CommandAdapt['pageScaleMinus']
|
private static pageScaleMinus: CommandAdapt['pageScaleMinus']
|
||||||
@@ -138,6 +139,7 @@ export class Command {
|
|||||||
Command.getImage = adapt.getImage.bind(adapt)
|
Command.getImage = adapt.getImage.bind(adapt)
|
||||||
Command.getValue = adapt.getValue.bind(adapt)
|
Command.getValue = adapt.getValue.bind(adapt)
|
||||||
Command.getWordCount = adapt.getWordCount.bind(adapt)
|
Command.getWordCount = adapt.getWordCount.bind(adapt)
|
||||||
|
Command.getRangeText = adapt.getRangeText.bind(adapt)
|
||||||
Command.pageMode = adapt.pageMode.bind(adapt)
|
Command.pageMode = adapt.pageMode.bind(adapt)
|
||||||
Command.pageScaleRecovery = adapt.pageScaleRecovery.bind(adapt)
|
Command.pageScaleRecovery = adapt.pageScaleRecovery.bind(adapt)
|
||||||
Command.pageScaleMinus = adapt.pageScaleMinus.bind(adapt)
|
Command.pageScaleMinus = adapt.pageScaleMinus.bind(adapt)
|
||||||
@@ -389,6 +391,10 @@ export class Command {
|
|||||||
return Command.getWordCount()
|
return Command.getWordCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getRangeText(): string {
|
||||||
|
return Command.getRangeText()
|
||||||
|
}
|
||||||
|
|
||||||
// 页面模式、页面缩放、纸张大小、页边距
|
// 页面模式、页面缩放、纸张大小、页边距
|
||||||
public executePageMode(payload: PageMode) {
|
public executePageMode(payload: PageMode) {
|
||||||
return Command.pageMode(payload)
|
return Command.pageMode(payload)
|
||||||
|
|||||||
@@ -1400,6 +1400,10 @@ export class CommandAdapt {
|
|||||||
return this.workerManager.getWordCount()
|
return this.workerManager.getWordCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getRangeText(): string {
|
||||||
|
return this.range.toString()
|
||||||
|
}
|
||||||
|
|
||||||
public pageMode(payload: PageMode) {
|
public pageMode(payload: PageMode) {
|
||||||
this.draw.setPageMode(payload)
|
this.draw.setPageMode(payload)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { ElementType } from '../..'
|
import { ElementType } from '../..'
|
||||||
|
import { ZERO } from '../../dataset/constant/Common'
|
||||||
import { ControlComponent } from '../../dataset/enum/Control'
|
import { ControlComponent } from '../../dataset/enum/Control'
|
||||||
import { IEditorOption } from '../../interface/Editor'
|
import { IEditorOption } from '../../interface/Editor'
|
||||||
import { IElement } from '../../interface/Element'
|
import { IElement } from '../../interface/Element'
|
||||||
@@ -253,4 +254,12 @@ export class RangeManager {
|
|||||||
ctx.restore()
|
ctx.restore()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public toString(): string {
|
||||||
|
const selection = this.getSelection()
|
||||||
|
if (!selection) return ''
|
||||||
|
return selection.map(s => s.value)
|
||||||
|
.join('')
|
||||||
|
.replace(new RegExp(ZERO, 'g'), '')
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user