SliderDynamicChange

Signed-off-by: ylh <yanlianhui1@huawei.com>
This commit is contained in:
ylh
2022-05-12 14:55:35 +08:00
parent e157d017f9
commit da205ef23e
3 changed files with 23 additions and 7 deletions
@@ -365,15 +365,18 @@ export struct NoteDataMoveDialog {
}
}
let inSetValue = AppStorage.Link('inSetValue')
@CustomDialog
export struct EditContentDialog {
editContentDialogCtl: CustomDialogController
confirm: (excuteJs: string) => void
@State selectFontColor: string = fontColorArray[0]
@State inSetValue: number = 20
@StorageLink("inSetValue") inSetValue: number = 4
private circleColor: string
private fontSize: number
aboutToAppear(){
this.confirm("javascript:RICH_EDITOR.getFontSizes()")
}
build() {
Row() {
Column() {
@@ -599,7 +602,7 @@ export struct EditContentDialog {
.showSteps(false)
.showTips(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.inSetValue = value
AppStorage.Set<number>('inSetValue', value)
this.fontSize = value + 12
this.confirm("javascript:RICH_EDITOR.execFontSize('" + this.fontSize + "')")
LogUtil.info(TAG, 'value:' + value + 'mode:' + mode.toString())
@@ -34,6 +34,7 @@ const TAG = "NoteContentComp"
var timeId : number
// Note content component
let inSetValue = AppStorage.Link('inSetValue')
@Component
export struct NoteContentComp {
@Consume('SelectedNoteData') selectedNoteData: NoteData
@@ -100,8 +101,13 @@ export struct NoteContentComp {
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
LogUtil.info(TAG, 'callbackScheduledSave, set continue note success')
}
},
callbackGetSize: (size) => {
if(size) {
AppStorage.Set<number>('inSetValue', parseInt(size.slice(0,-2)) - 12)
}
}
}
build() {
@@ -125,7 +131,7 @@ export struct NoteContentComp {
this.controllerShow.registerJavaScriptProxy({
object: this.noteContent,
name: "callBackToApp", // html--> name.method
methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave"],
methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave", "callbackGetSize"],
})
LogUtil.info(TAG, "finish register")
this.controllerShow.refresh()
@@ -268,11 +274,11 @@ export struct NoteContentOverViewComp {
.fontSize(12)
.padding({ top: 4, bottom: 4 })
.fontColor($r("app.color.modified_time_font_color"))
.margin({ left: 12 })
.margin({ left: 12 })
Row() {
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
.fontSize(12)
.fontColor($r("app.color.list_modified_time_font_color"))
.fontColor($r("app.color.list_modified_time_font_color"))
Image($r('app.media.triangle'))
.width(6)
.height(12)
@@ -327,4 +327,11 @@ function scheduled_save_content() {
var htmlString = RICH_EDITOR.getHtml()
var str = callBackToApp.callbackScheduledSave(htmlString)
console.info('scheduled_save_content end')
}
RICH_EDITOR.getFontSizes = function(){
document.execCommand("fontSize", false, null);
var fontElements = window.getSelection().anchorNode.parentNode
var getSize = fontElements.style.fontSize
var str = callBackToApp.callbackGetSize(getSize)
}