mirror of
https://gitee.com/openharmony/applications_notes
synced 2024-10-06 21:23:27 +00:00
蓝黄区代码同步
Signed-off-by: nobbo <gaoshang22@huawei.com>
This commit is contained in:
parent
677293b667
commit
ca012444bc
@ -73,7 +73,7 @@ RICH_EDITOR.getListStyle = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'OL') {
|
||||
console.info('insertOrderedList');
|
||||
@ -111,7 +111,7 @@ RICH_EDITOR.setNumbers = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'OL') {
|
||||
child.style['list-style'] = 'decimal';
|
||||
@ -142,7 +142,7 @@ RICH_EDITOR.setABC = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'OL') {
|
||||
child.style['list-style'] = 'lower-alpha';
|
||||
@ -173,7 +173,7 @@ RICH_EDITOR.setBullets = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'UL') {
|
||||
child.style['list-style'] = 'disc';
|
||||
@ -204,7 +204,7 @@ RICH_EDITOR.setSquare = function () {
|
||||
}
|
||||
var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange();
|
||||
try {
|
||||
var child = range.commonAncestorContainer.parentNode;
|
||||
var child = range.commonAncestorContainer;
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (child.nodeName === 'UL') {
|
||||
child.style['list-style'] = 'square';
|
||||
|
@ -84,6 +84,7 @@ export class NoteUtil {
|
||||
LogUtil.info(TAG, "setAllNotesChecked")
|
||||
this.unsetAllNotesChecked(checkedNoteArray)
|
||||
checkedNoteArray.push(...noteArray)
|
||||
AppStorage.Set('CheckedNoteArray', checkedNoteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,6 +95,7 @@ export class NoteUtil {
|
||||
unsetAllNotesChecked(checkedNoteArray: NoteData[]) {
|
||||
LogUtil.info(TAG, "unsetAllNotesChecked")
|
||||
checkedNoteArray.splice(0, checkedNoteArray.length)
|
||||
AppStorage.Set('CheckedNoteArray', checkedNoteArray)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,8 +200,14 @@ export default {
|
||||
let title = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.Title))
|
||||
let uuid = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.Uuid))
|
||||
let folder_uuid = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.FolderUuid))
|
||||
let content_text = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentText))
|
||||
let content_img = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentImg))
|
||||
let content_text = '';
|
||||
let content_img = '';
|
||||
try {
|
||||
content_text = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentText))
|
||||
content_img = resultSet_note.getString(resultSet_note.getColumnIndex(NoteTableColumn.ContentImg))
|
||||
} catch (err) {
|
||||
LogUtil.error(TAG, "initAppStorage, content_img = error : " + err)
|
||||
}
|
||||
let noteType = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.NoteType))
|
||||
let is_top = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsTop))
|
||||
let is_favorite = resultSet_note.getLong(resultSet_note.getColumnIndex(NoteTableColumn.IsFavorite))
|
||||
|
@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import util from '@ohos.util'
|
||||
import {LogUtil} from '../../baseUtil/LogUtil'
|
||||
import NoteData from '../../model/databaseModel/NoteData'
|
||||
import ohosDataRdb from '@ohos.data.rdb';
|
||||
@ -21,6 +20,7 @@ import {TableName, NoteTableColumn} from '../../model/databaseModel/EnumData'
|
||||
import NoteUtil from '../../baseUtil/NoteUtil'
|
||||
import RdbStoreUtil from '../../baseUtil/RdbStoreUtil'
|
||||
import SysDefData from '../../model/databaseModel/SysDefData'
|
||||
import util from '@ohos.util'
|
||||
|
||||
const TAG = "SearchModel"
|
||||
|
||||
@ -41,7 +41,7 @@ export class SearchModel {
|
||||
LogUtil.info(TAG, "query is null")
|
||||
return []
|
||||
}
|
||||
let searchData: NoteData[] = []
|
||||
let searchData: NoteData[] = [];
|
||||
noteDataArray.forEach((noteData) => {
|
||||
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
|
||||
let contentTextValue: string
|
||||
|
@ -19,6 +19,7 @@ import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil'
|
||||
import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData'
|
||||
import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil'
|
||||
import { circleColorArray, fontColorArray, SysDefFolderUuid, DeleteFileType, FolderType, LogUtil } from '@ohos/utils'
|
||||
import inputMethod from '@ohos.inputmethod'
|
||||
|
||||
const TAG = "CusDialogComp"
|
||||
|
||||
@ -98,6 +99,8 @@ export struct NewOrEditFolderDialog {
|
||||
.width('48%')
|
||||
.onClick(() => {
|
||||
this.newOrEditFolderDialogCtl.close()
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
Divider()
|
||||
.vertical(true)
|
||||
@ -120,6 +123,8 @@ export struct NewOrEditFolderDialog {
|
||||
.onClick(() => {
|
||||
this.newOrEditFolderDialogCtl.close()
|
||||
this.confirm(this.selectedColor, this.inputName)
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
}.width('100%')
|
||||
.margin({ top: 21, bottom: 25 })
|
||||
@ -391,7 +396,6 @@ export struct EditContentDialog {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
private circleColor: string
|
||||
private fontSize: number
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
|
||||
aboutToAppear() {
|
||||
this.confirm("javascript:RICH_EDITOR.getFontSizes()")
|
||||
@ -579,7 +583,6 @@ export struct EditContentDialog {
|
||||
.fillColor('#99182431')
|
||||
.onClick(() => {
|
||||
this.editContentDialogCtl.close()
|
||||
this.closeEditContentDialog = true
|
||||
})
|
||||
}
|
||||
.height(36)
|
||||
@ -656,7 +659,7 @@ export struct EditTitleDialog {
|
||||
editTitleDialog: CustomDialogController
|
||||
confirm: (newTitle: string) => void
|
||||
@State inputName: string = ""
|
||||
private isEquivalentVal: boolean= true
|
||||
@State isEquivalentVal: boolean= true
|
||||
|
||||
|
||||
build() {
|
||||
@ -675,10 +678,10 @@ export struct EditTitleDialog {
|
||||
.backgroundColor($r("app.color.title_input_bg_color"))
|
||||
.width('90%')
|
||||
.onChange((value: string) => {
|
||||
if (this.inputName == value) {
|
||||
let reg = /^\S+$/
|
||||
if (this.inputName == value && reg.test(value)) {
|
||||
this.isEquivalentVal = true
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.isEquivalentVal = false
|
||||
}
|
||||
this.inputName = value
|
||||
@ -696,6 +699,8 @@ export struct EditTitleDialog {
|
||||
.width('48%')
|
||||
.onClick(() => {
|
||||
this.editTitleDialog.close()
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
Divider()
|
||||
.vertical(true)
|
||||
@ -712,6 +717,8 @@ export struct EditTitleDialog {
|
||||
.onClick(() => {
|
||||
this.editTitleDialog.close()
|
||||
this.confirm(this.inputName)
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
})
|
||||
}.width('100%')
|
||||
.margin({ top: 21, bottom: 25 })
|
||||
@ -730,7 +737,6 @@ export struct EditContentDialogPortrait {
|
||||
confirm: (excuteJs: string) => void
|
||||
@State selectFontColor: string = fontColorArray[0]
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
private circleColor: string
|
||||
private fontSize: number
|
||||
|
||||
@ -748,7 +754,6 @@ export struct EditContentDialogPortrait {
|
||||
.fillColor($r("app.color.font_stylecolor_AD182431"))
|
||||
.onClick(() => {
|
||||
this.editContentDialogCtl.close()
|
||||
this.closeEditContentDialog = true
|
||||
})
|
||||
}
|
||||
.height(48)
|
||||
|
@ -76,7 +76,8 @@ export struct FolderListComp {
|
||||
}
|
||||
}
|
||||
}, folderItem => folderItem.name.toString())
|
||||
}.width('100%').height(450)
|
||||
}.width('100%').height(500)
|
||||
.margin({ bottom: 120 })
|
||||
.padding({ left: 12, right: 12 })
|
||||
.flexGrow(1)
|
||||
}
|
||||
@ -176,7 +177,7 @@ struct FolderItemComp {
|
||||
@Consume('SelectedColor') selectedColor: string
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
controllerShow: WebController
|
||||
private isLongPress: boolean = false
|
||||
@State isLongPress: boolean = false
|
||||
TAG = "FolderListComp"
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
// Folder Edit Dialog
|
||||
|
@ -44,7 +44,6 @@ var timeID: number
|
||||
|
||||
@Component
|
||||
export struct NoteContent {
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
@Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('NewNote')
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Provide('Issave') issave: number = 0
|
||||
@ -202,23 +201,21 @@ export struct NoteContent {
|
||||
.onScroll((event) => {
|
||||
this.storeScrollTop(event.yOffset)
|
||||
})
|
||||
.onClick(() => {
|
||||
// 添加定时器:3s自动保存
|
||||
if (timeID) {
|
||||
clearInterval(timeID)
|
||||
}
|
||||
timeID = setInterval(() => {
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval timeID : " + timeID)
|
||||
this.issave = 0
|
||||
this.editModel = true
|
||||
})
|
||||
}
|
||||
.margin({ left: 12, right: 24, top: 16 })
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.onClick(() => {
|
||||
// 添加定时器:3s自动保存
|
||||
if (timeID) {
|
||||
clearInterval(timeID)
|
||||
}
|
||||
timeID = setInterval(() => {
|
||||
if (this.closeEditContentDialog) {
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval timeID : " + timeID)
|
||||
this.issave = 0
|
||||
this.editModel = true
|
||||
})
|
||||
}
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
@ -238,7 +235,6 @@ export struct NoteContent {
|
||||
|
||||
@Component
|
||||
export struct ToolBarComp {
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Consume('Issave') issave: number
|
||||
@ -249,13 +245,8 @@ export struct ToolBarComp {
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
cancel: this.existApp
|
||||
})
|
||||
|
||||
existApp() {
|
||||
this.closeEditContentDialog = true
|
||||
}
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
@ -275,6 +266,7 @@ export struct ToolBarComp {
|
||||
clearInterval(timeID)
|
||||
}
|
||||
router.back()
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
.visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
|
||||
|
||||
@ -323,7 +315,6 @@ export struct ToolBarComp {
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
LogUtil.info(TAG, 'editContentDialogCtl start')
|
||||
this.closeEditContentDialog = false
|
||||
this.editContentDialogCtl.open()
|
||||
})
|
||||
}.width(42)
|
||||
@ -447,6 +438,7 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, "NoteContentOverViewComp confirm, set continue note success")
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
@ -482,6 +474,7 @@ export struct NoteContentOverViewComp {
|
||||
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.selectedNoteData.title)
|
||||
.id(this.isUpdate+'')
|
||||
.fontSize(30)
|
||||
.margin({ left: 12, right: 24 })
|
||||
.onClick(() => {
|
||||
|
@ -54,7 +54,6 @@ export struct NoteContentComp {
|
||||
@Consume('LastSectionStatus') lastSectionStatus: number
|
||||
@Consume('Issave') issave: number
|
||||
@Consume('Search') search: boolean
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
controllerShow: WebController
|
||||
private editContentFlag = false
|
||||
@State uri1: string = ""
|
||||
@ -260,9 +259,7 @@ export struct NoteContentComp {
|
||||
clearInterval(timeId)
|
||||
}
|
||||
timeId = setInterval(() => {
|
||||
if (this.closeEditContentDialog) {
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval timeId : " + timeId)
|
||||
// save continue data
|
||||
@ -335,6 +332,7 @@ export struct NoteContentOverViewComp {
|
||||
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
|
||||
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
|
||||
RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null)
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
@ -379,6 +377,7 @@ export struct NoteContentOverViewComp {
|
||||
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.selectedNoteData.title)
|
||||
.id(this.isUpdate+'')
|
||||
.fontSize(30)
|
||||
.margin({ left: 0, right: 24 })
|
||||
.onClick(() => {
|
||||
@ -442,7 +441,6 @@ export struct ToolBarComp {
|
||||
@Consume('Issave') issave: number
|
||||
controllerShow: WebController
|
||||
private context = getContext(this)
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }),
|
||||
alignment: DialogAlignment.Center,
|
||||
@ -481,13 +479,8 @@ export struct ToolBarComp {
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
cancel: this.exisApp
|
||||
})
|
||||
|
||||
exisApp() {
|
||||
this.closeEditContentDialog = true
|
||||
}
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
@ -527,6 +520,7 @@ export struct ToolBarComp {
|
||||
// save continue data
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
|
||||
LogUtil.info(TAG, "ToolBarComp, set continue section success")
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
.visibility(!this.selectedNoteData ? Visibility.None : this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible)
|
||||
|
||||
@ -602,7 +596,6 @@ export struct ToolBarComp {
|
||||
// 退出键盘
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession();
|
||||
this.closeEditContentDialog = false
|
||||
this.editContentDialogCtl.open()
|
||||
})
|
||||
}.width(42)
|
||||
@ -644,6 +637,7 @@ export struct ToolBarComp {
|
||||
})
|
||||
}
|
||||
}
|
||||
NoteUtil.refreshAll()
|
||||
});
|
||||
})
|
||||
}.width(42)
|
||||
|
@ -56,7 +56,6 @@ export struct NoteContentCompPortrait {
|
||||
@Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get("NewFolder")
|
||||
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray')
|
||||
@Provide('EditModel') editModel: boolean = false
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
controllerShow: WebController
|
||||
private editContentFlag = false
|
||||
@StorageLink('ScrollTopPercent') scrollTopPercent: number = 0.0
|
||||
@ -211,9 +210,7 @@ export struct NoteContentCompPortrait {
|
||||
}
|
||||
// 添加定时器:3s自动保存
|
||||
time_id = setInterval(() => {
|
||||
if (this.closeEditContentDialog) {
|
||||
this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" })
|
||||
}
|
||||
}, 3000)
|
||||
LogUtil.info(TAG, "setInterval time_id : " + time_id)
|
||||
this.editModel = true
|
||||
@ -270,6 +267,7 @@ export struct NoteContentOverViewComp {
|
||||
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
LogUtil.info(TAG, 'NoteContentOverViewComp, MenuBuilder, set continue note success')
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
@Builder MenuBuilder() {
|
||||
@ -308,7 +306,9 @@ export struct NoteContentOverViewComp {
|
||||
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
|
||||
justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Row() {
|
||||
Text(this.selectedNoteData.title).fontSize(30).fontWeight(FontWeight.Medium)
|
||||
Text(this.selectedNoteData.title)
|
||||
.id(this.isUpdate+'')
|
||||
.fontSize(30).fontWeight(FontWeight.Medium)
|
||||
.onClick(() => {
|
||||
clearInterval(time_id)
|
||||
this.editTitleDialogCtl.open()
|
||||
@ -586,20 +586,14 @@ export struct EditNoteCompForPortrait {
|
||||
@Consume('SelectedFolderData') selectedFolderData: FolderData
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData;
|
||||
@Consume('EditModel') editModel: boolean
|
||||
@StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog')
|
||||
controllerShow: WebController
|
||||
editContentDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this) }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
autoCancel: true,
|
||||
customStyle: true,
|
||||
cancel: this.exissApp
|
||||
})
|
||||
|
||||
exissApp() {
|
||||
this.closeEditContentDialog = true
|
||||
}
|
||||
|
||||
confirm(excuteJs: string) {
|
||||
this.controllerShow.runJavaScript({ script: excuteJs })
|
||||
}
|
||||
@ -631,7 +625,6 @@ export struct EditNoteCompForPortrait {
|
||||
.height(24)
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.onClick(() => {
|
||||
this.closeEditContentDialog = false
|
||||
this.editContentDialogCtl.open()
|
||||
})
|
||||
Text($r("app.string.style"))
|
||||
|
@ -35,6 +35,7 @@ import SearchModel from '@ohos/utils/src/main/ets/default/model/searchModel/Sear
|
||||
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
|
||||
import router from '@system.router';
|
||||
import rs from '@ohos.resourceManager'
|
||||
import inputMethod from '@ohos.inputmethod';
|
||||
|
||||
const TAG = "NoteListComp"
|
||||
|
||||
@ -218,11 +219,18 @@ export struct NoteItemComp {
|
||||
@State isChecked: boolean = undefined
|
||||
@Consume('Longpress')@Watch('isLongPress') longpress: boolean
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
|
||||
isLongPress(){
|
||||
if(this.longpress){
|
||||
this.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
updateAndGetChecked() {
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
return this.isChecked
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) {
|
||||
@ -264,6 +272,7 @@ export struct NoteItemComp {
|
||||
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
|
||||
Stack({ alignContent: Alignment.Center }) {
|
||||
Image(this.noteItem.content_img)
|
||||
.id(this.isUpdate+'')
|
||||
.height(47)
|
||||
.width(47)
|
||||
.borderRadius(12)
|
||||
@ -278,7 +287,8 @@ export struct NoteItemComp {
|
||||
Image($r("app.media.checked"))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.visibility(this.isChecked ? Visibility.Visible : Visibility.None)
|
||||
.visibility(this.updateAndGetChecked() ? Visibility.Visible : Visibility.None)
|
||||
.id(this.isUpdate+'')
|
||||
}.width(24)
|
||||
.height(24)
|
||||
.visibility(this.longpress ? Visibility.Visible : Visibility.None)
|
||||
@ -303,17 +313,18 @@ export struct NoteItemComp {
|
||||
.onClick(() => {
|
||||
if (this.search) {
|
||||
this.search = false
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
return
|
||||
}
|
||||
if (this.longpress) {
|
||||
if (NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)) {
|
||||
NoteUtil.unsetNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem) ? true : false
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
} else {
|
||||
NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem) ? true : false
|
||||
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
@ -376,6 +387,7 @@ export struct NoteItemListComp {
|
||||
this.dateList = NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
|
||||
}
|
||||
this.isUpdate = false
|
||||
this.doSearch()
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
@ -383,6 +395,9 @@ export struct NoteItemListComp {
|
||||
}
|
||||
|
||||
doSearch() {
|
||||
if (this.inputKeyword.length == 0) {
|
||||
return
|
||||
}
|
||||
SearchModel.search(NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid), this.inputKeyword)
|
||||
.then((result: NoteData[]) => {
|
||||
LogUtil.info(TAG, "result size " + result.length.toString())
|
||||
@ -464,7 +479,7 @@ export struct NoteItemListComp {
|
||||
.margin((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? {
|
||||
bottom: 0
|
||||
} : {
|
||||
bottom: 130
|
||||
bottom: 56
|
||||
})
|
||||
.layoutWeight(1)
|
||||
.listDirection(Axis.Vertical)
|
||||
@ -489,6 +504,7 @@ export struct NoteItemListComp {
|
||||
}
|
||||
.onClick(() => {
|
||||
this.search = false
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -503,6 +519,7 @@ export struct OperateNoteComp {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@Consume('selectedAll') selectedAll: boolean
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
controllerShow: WebController
|
||||
noteDataMoveDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }),
|
||||
@ -530,6 +547,7 @@ export struct OperateNoteComp {
|
||||
this.longpress = false
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
}
|
||||
|
||||
noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({
|
||||
@ -648,19 +666,21 @@ export struct OperateNoteComp {
|
||||
Image(this.CheckedNoteArray.length == NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length ? $r('app.media.check_all1') : $r('app.media.check_all'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.id(this.isUpdate + '')
|
||||
.onClick(() => {
|
||||
LogUtil.info(TAG, "select all click")
|
||||
if (this.CheckedNoteArray.length <
|
||||
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
|
||||
.length) {
|
||||
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length) {
|
||||
NoteUtil.setAllNotesChecked(this.CheckedNoteArray, NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid))
|
||||
} else {
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
}
|
||||
this.selectedAll = !this.selectedAll
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
}
|
||||
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 120 : 248)
|
||||
.width(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 168 : 248)
|
||||
.visibility(this.longpress && this.portraitModel == false ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
}
|
||||
@ -737,6 +757,10 @@ export struct SearchComp {
|
||||
.visibility(this.search ? Visibility.Visible : Visibility.None)
|
||||
.onClick(() => {
|
||||
this.search = false
|
||||
// 退出键盘
|
||||
// @ts-ignore
|
||||
inputMethod.getController().stopInputSession()
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
})
|
||||
|
||||
Flex({ justifyContent: FlexAlign.Start }) {
|
||||
@ -760,8 +784,10 @@ export struct SearchComp {
|
||||
.onClick(() => {
|
||||
if (this.longpress) {
|
||||
this.search = false
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
} else {
|
||||
this.search = true
|
||||
AppStorage.SetOrCreate<boolean>('Search', this.search)
|
||||
}
|
||||
})
|
||||
// whether the focus is on the search input before coutinue
|
||||
@ -796,6 +822,7 @@ export struct OperateNoteCompForPortrait {
|
||||
@Consume('SelectedNoteData') selectedNoteData: NoteData
|
||||
@Consume('PortraitModel') portraitModel: boolean
|
||||
@State greyOpacity: boolean = false
|
||||
@StorageLink('isUpdate') isUpdate: boolean = false
|
||||
noteDataMoveDialogCtlBottom: CustomDialogController = new CustomDialogController({
|
||||
builder: NoteDataMoveDialog({ onConfirm: this.onMoveConfirm.bind(this) }),
|
||||
alignment: DialogAlignment.Bottom,
|
||||
@ -889,6 +916,7 @@ export struct OperateNoteCompForPortrait {
|
||||
this.longpress = false
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Text($r("app.string.set_top"))
|
||||
.opacity(this.greyOpacity ? 0.4 : 1)
|
||||
@ -1005,6 +1033,7 @@ export struct OperateNoteCompForPortrait {
|
||||
.width(24)
|
||||
.height(24)
|
||||
.responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
|
||||
.id(this.isUpdate + '')
|
||||
.onClick(() => {
|
||||
if (this.CheckedNoteArray.length <
|
||||
NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid)
|
||||
@ -1014,6 +1043,7 @@ export struct OperateNoteCompForPortrait {
|
||||
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
|
||||
}
|
||||
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
|
||||
NoteUtil.refreshAll()
|
||||
})
|
||||
Text($r("app.string.check_all"))
|
||||
.fontSize(10)
|
||||
|
@ -35,9 +35,7 @@ export default class MainAbility extends Ability {
|
||||
LogUtil.info(this.Tag, " getLastWindow:" + windowWidth)
|
||||
this.screenBreakPoints(windowWidth)
|
||||
})
|
||||
AppStorage.SetOrCreate<boolean>('closeEditContentDialog', true)
|
||||
LogUtil.info(this.Tag, " onCreate, launchReason is " + launchParam.launchReason +
|
||||
", deviceType" + deviceInfo.deviceType)
|
||||
LogUtil.info(this.Tag, " onCreate, launchReason is " + launchParam.launchReason + ", deviceType" + deviceInfo.deviceType)
|
||||
if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') {
|
||||
AppStorage.SetOrCreate<boolean>('Expand', false)
|
||||
AppStorage.SetOrCreate<boolean>('Choose', true)
|
||||
@ -46,11 +44,13 @@ export default class MainAbility extends Ability {
|
||||
// 设置迁移标记
|
||||
AppStorage.SetOrCreate<boolean>('IsContinue', true)
|
||||
// 获取对端的迁移数据
|
||||
let Search: boolean = want.parameters["Search"]
|
||||
let continueNote: string = want.parameters["ContinueNote"]
|
||||
let continueSection: number = want.parameters["ContinueSection"]
|
||||
let scrollTopPercent: number = want.parameters["ScrollTopPercent"]
|
||||
let isFocusOnSearch: boolean = want.parameters["isFocusOnSearch"]
|
||||
LogUtil.info(this.Tag, " continueSection : " + continueSection)
|
||||
AppStorage.SetOrCreate<boolean>('Search', Search)
|
||||
AppStorage.SetOrCreate<string>('ContinueNote', continueNote)
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', continueSection)
|
||||
// 使用新的key保存数据,防止迁移过来的数据在使用前被本地操作覆盖
|
||||
@ -108,6 +108,7 @@ export default class MainAbility extends Ability {
|
||||
onContinue(wantParam: { [key: string]: any }) {
|
||||
LogUtil.info(this.Tag, " onContinue")
|
||||
// 获取本端的迁移数据
|
||||
let Search = AppStorage.Get<boolean>('Search')
|
||||
let continueNote = AppStorage.Get<string>('ContinueNote')
|
||||
if (continueNote == undefined || continueNote == null) {
|
||||
LogUtil.info(this.Tag, " onContinue, continueNote is error, default [0]")
|
||||
@ -134,6 +135,7 @@ export default class MainAbility extends Ability {
|
||||
}
|
||||
|
||||
// 保存本端的迁移数据
|
||||
wantParam["Search"] = Search
|
||||
wantParam["ContinueNote"] = continueNote
|
||||
wantParam["ContinueSection"] = continueSection
|
||||
wantParam["ScrollTopPercent"] = scrollTopPercent
|
||||
|
@ -38,7 +38,7 @@ export struct NoteHomeComp {
|
||||
@Provide('Longpress') longpress: boolean = false // 第二栏长按状态
|
||||
@Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态
|
||||
@Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开
|
||||
@Provide('Search') search: boolean = false // 是否处于搜索状态
|
||||
@Provide('Search') search: boolean = AppStorage.Get('Search') // 是否处于搜索状态
|
||||
@Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
|
||||
@Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
|
||||
@Provide('SelectedAll') selectedAll: boolean = false
|
||||
@ -160,7 +160,7 @@ export struct NoteHomeComp {
|
||||
let continueFromPhone = AppStorage.Get<boolean>('ContinueFromPhone')
|
||||
LogUtil.info(this.TAG, "aboutToAppear, continueFromPhone : " + continueFromPhone)
|
||||
if (continueFromPhone) {
|
||||
this.sectionStatus = 3
|
||||
this.sectionStatus = 1
|
||||
}
|
||||
// save continue data
|
||||
AppStorage.SetOrCreate<number>('ContinueSection', this.sectionStatus)
|
||||
|
@ -75,7 +75,7 @@ export struct NoteHomePortraitComp {
|
||||
.width("100%")
|
||||
.backgroundColor("#18181A")
|
||||
.opacity(0.2)
|
||||
.visibility(this.expandStatus ? Visibility.Visible : Visibility.Hidden)
|
||||
.visibility(this.expandStatus ? Visibility.Visible : Visibility.None)
|
||||
}
|
||||
}
|
||||
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
|
||||
|
Loading…
Reference in New Issue
Block a user