diff --git a/common/resources/src/main/resources/rawfile/editor.html b/common/resources/src/main/resources/rawfile/editor.html
index fe612a7..40acf99 100644
--- a/common/resources/src/main/resources/rawfile/editor.html
+++ b/common/resources/src/main/resources/rawfile/editor.html
@@ -24,7 +24,7 @@

diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js
index fcb41b3..32e9f68 100644
--- a/common/resources/src/main/resources/rawfile/rich_editor.js
+++ b/common/resources/src/main/resources/rawfile/rich_editor.js
@@ -24,6 +24,7 @@ RICH_EDITOR.setHtml = function (contents) {
}
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
if (base64regex.test(contents)) {
+ console.log('setHtml:'+decodeURIComponent(escape(atob(contents))));
RICH_EDITOR.editor.innerHTML = decodeURIComponent(escape(atob(contents)));
} else {
RICH_EDITOR.editor.innerHTML = contents;
@@ -392,6 +393,7 @@ function getHtmlContent() {
console.log('getHtmlContent');
let htmlString = RICH_EDITOR.getHtml();
let imgName = getImagePathFromContent(htmlString);
+ console.log('getHtmlContent:'+htmlString)
htmlString = window.btoa(unescape(encodeURIComponent(htmlString)));
callBackToApp.callbackImagePath(imgName);
let str = callBackToApp.callbackhtml(htmlString);
diff --git a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets
index d4d8fbd..76504a1 100644
--- a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets
+++ b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets
@@ -46,14 +46,16 @@ export class SearchModel {
noteDataArray.forEach((noteData) => {
let base64regex = new RegExp('/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/');
let contentTextValue: string
+ LogUtil.info(TAG, "content_text " + noteData.content_text)
if (base64regex.test(noteData.content_text) && noteData.content_text.length > 0) {
- let Base64 = new util.Base64()
- let textDecoder = new util.TextDecoder("utf-8", { ignoreBOM: true }) // utf-8:编码格式为utf-8,ignoreBOM:是否忽略BOM标记
- let decodeStr = Base64.decodeSync(noteData.content_text)
- contentTextValue = textDecoder.decode(decodeStr, { stream: false }) // stream:在随后的decode()调用中是否跟随附加数据块
+ let base64 = new util.Base64Helper()
+ let textDecoder:util.TextDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true }) // utf-8:编码格式为utf-8,ignoreBOM:是否忽略BOM标记
+ let decodeStr = base64.decodeSync(noteData.content_text)
+ contentTextValue = textDecoder.decodeToString(decodeStr, { stream: false }) // stream:在随后的decode()调用中是否跟随附加数据块
} else {
contentTextValue = noteData.content_text
}
+ LogUtil.info(TAG, "contentTextValue " + contentTextValue)
if (contentTextValue.replace(new RegExp('/<[^>]+>/g'), "").toLowerCase().indexOf(query.toLowerCase()) != -1
|| noteData.title.toLowerCase().indexOf(query.toLowerCase()) != -1) {
LogUtil.info(TAG, "uuid " + noteData.uuid)
diff --git a/features/src/main/ets/components/FolderListComp.ets b/features/src/main/ets/components/FolderListComp.ets
index f74c555..d82cb20 100644
--- a/features/src/main/ets/components/FolderListComp.ets
+++ b/features/src/main/ets/components/FolderListComp.ets
@@ -49,19 +49,16 @@ export struct FolderListComp {
Image($r("app.media.suojin"))
.height(24)
.width(24)
- .responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 })
+ .responseRegion({
+ x: -15.0,
+ y: -15.0,
+ width: 54,
+ height: 54
+ })
.onClick(() => {
- if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
- animateTo({ duration: 200 }, () => {
- this.expandStatus = !this.expandStatus
- })
- } else {
- this.asideWidth = 0
- this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
- // save continue data
- AppStorage.SetOrCreate
('ContinueSection', this.sectionStatus)
- LogUtil.info(this.TAG, "FolderListComp, set continue section success")
- }
+ this.getUIContext().animateTo({ duration: 200 }, () => {
+ this.expandStatus = !this.expandStatus
+ })
})
}
.alignItems(HorizontalAlign.Start)
@@ -125,17 +122,21 @@ export struct NoteAndCreateComp {
@Consume('SelectedColor') selectedColor: string
@Consume('PortraitModel') portraitModel: boolean
folderCreateDialogCtl: CustomDialogController | null = new CustomDialogController({
- builder: NewOrEditFolderDialog({ confirm: (color: string, name: string) => {
- this.onCreateConfirm(color, name)
- }, dialogType: 0 }),
+ builder: NewOrEditFolderDialog({
+ confirm: (color: string, name: string) => {
+ this.onCreateConfirm(color, name)
+ }, dialogType: 0
+ }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
folderCreateDialogCtlBottom: CustomDialogController | null = new CustomDialogController({
- builder: NewOrEditFolderDialog({ confirm: (color: string, name: string) => {
- this.onCreateConfirm(color, name)
- }, dialogType: 0 }),
+ builder: NewOrEditFolderDialog({
+ confirm: (color: string, name: string) => {
+ this.onCreateConfirm(color, name)
+ }, dialogType: 0
+ }),
alignment: DialogAlignment.Bottom,
autoCancel: false,
customStyle: true,
@@ -147,7 +148,9 @@ export struct NoteAndCreateComp {
}
onCreateConfirm(color: string, name: string) {
- let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1
+ let folderData =
+ new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(),
+ new Date().getTime()) // 新的的笔记本都是自定义类型 type为1
this.AllFolderArray.push(folderData)
// insert folder to db
RdbStoreUtil.insert(TableName.FolderTable, folderData.toFolderObject(), null);
@@ -184,7 +187,9 @@ export struct NoteAndCreateComp {
@Component
struct FolderItemComp {
- @State folderItem: FolderData = new FolderData(0, "", new Date().getTime() + "", "", FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime())
+ @State folderItem: FolderData =
+ new FolderData(0, "", new Date().getTime() + "", "", FolderType.CusDef, Delete.No, new Date().getTime(),
+ new Date().getTime())
@StorageLink('AllNoteArray') AllNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@@ -248,22 +253,27 @@ struct FolderItemComp {
// Folder Delete Dialog
folderDeleteDialogCtl: CustomDialogController | null = new CustomDialogController({
- builder: DeleteDialog({ onConfirm: () => {
- this.onDeleteConfirm();
- }, deleteFileType: DeleteFileType.FolderData }),
+ builder: DeleteDialog({
+ onConfirm: () => {
+ this.onDeleteConfirm();
+ }, deleteFileType: DeleteFileType.FolderData
+ }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
// Folder Delete Dialog for portrait model
folderDeleteDialogCtlBottom: CustomDialogController | null = new CustomDialogController({
- builder: DeleteDialog({ onConfirm: () => {
- this.onDeleteConfirm();
- }, deleteFileType: DeleteFileType.FolderData }),
+ builder: DeleteDialog({
+ onConfirm: () => {
+ this.onDeleteConfirm();
+ }, deleteFileType: DeleteFileType.FolderData
+ }),
alignment: DialogAlignment.Bottom,
autoCancel: false,
customStyle: true,
})
+
// Folder Delete Callback
onDeleteConfirm() {
let currentFolder = FolderUtil.getFolderData(this.AllFolderArray, this.folderItem.uuid)
@@ -306,19 +316,18 @@ struct FolderItemComp {
return
}
// 刷新web界面
- if (this.portraitModel == false) {
- try {
- this.controllerShow.runJavaScript(
- "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
- )
- LogUtil.info(this.TAG, `runJavaScript success.`);
- } catch (error) {
- LogUtil.error(this.TAG, `runJavaScript failed.code:${JSON.stringify(error.code)},message:${JSON.stringify(error.message)}`);
- }
+ try {
+ this.controllerShow.runJavaScript(
+ "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
+ )
+ LogUtil.info(this.TAG, `runJavaScript success.`);
+ } catch (error) {
+ LogUtil.error(this.TAG,
+ `runJavaScript failed.code:${JSON.stringify(error.code)},message:${JSON.stringify(error.message)}`);
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
- AppStorage.SetOrCreate('ContinueNote', continueNote)
+ AppStorage.setOrCreate('ContinueNote', continueNote)
LogUtil.info(this.TAG, "onDeleteConfirm, set continue note success")
}
this.isUpdate = true
@@ -326,18 +335,22 @@ struct FolderItemComp {
// Folder Create Dialog
folderCreateDialogCtl: CustomDialogController | null = new CustomDialogController({
- builder: NewOrEditFolderDialog({ confirm: (color: string, name: string) => {
- this.onCreateConfirm(color, name);
- }, dialogType: 0 }),
+ builder: NewOrEditFolderDialog({
+ confirm: (color: string, name: string) => {
+ this.onCreateConfirm(color, name);
+ }, dialogType: 0
+ }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
})
// Folder Create Dialog for portrait model
folderCreateDialogCtlBottom: CustomDialogController | null = new CustomDialogController({
- builder: NewOrEditFolderDialog({ confirm: (color: string, name: string) => {
- this.onCreateConfirm(color, name);
- }, dialogType: 0 }),
+ builder: NewOrEditFolderDialog({
+ confirm: (color: string, name: string) => {
+ this.onCreateConfirm(color, name);
+ }, dialogType: 0
+ }),
alignment: DialogAlignment.Bottom,
autoCancel: false,
customStyle: true,
@@ -345,14 +358,17 @@ struct FolderItemComp {
// Folder Create Callback
onCreateConfirm(color: string, name: string) {
- let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1
+ let folderData =
+ new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(),
+ new Date().getTime()) // 新的的笔记本都是自定义类型 type为1
this.AllFolderArray.push(folderData)
// insert folder to db
RdbStoreUtil.insert(TableName.FolderTable, folderData.toFolderObject(), null);
this.isUpdate = true
}
- @Builder menuBuilder() {
+ @Builder
+ menuBuilder() {
Column({ space: 1 }) {
Text($r("app.string.editFolder"))
.width(124)
@@ -407,7 +423,12 @@ struct FolderItemComp {
}
.width(156)
.height(154)
- .padding({ top: 4, bottom: 4, left: 16, right: 16 })
+ .padding({
+ top: 4,
+ bottom: 4,
+ left: 16,
+ right: 16
+ })
.borderRadius(16)
.backgroundColor($r("app.color.press_folder_bg_color"))
}
@@ -422,7 +443,8 @@ struct FolderItemComp {
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
- .fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid))
+ .fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid,
+ this.selectedFolderData.uuid == this.folderItem.uuid))
.margin({ right: 16 })
Text(FolderUtil.getFolderText(this.folderItem))
.id(this.isUpdate + '')
@@ -447,8 +469,9 @@ struct FolderItemComp {
.borderRadius(12)
.height(56)
.padding({ left: 12, right: 12 })
- .backgroundColor(this.isLongPress ? $r("app.color.folder_color_19182431") : this.selectedFolderData.uuid == this.folderItem.uuid
- ? $r("app.color.folder_color_ffffff") : "#00FFFFFF")
+ .backgroundColor(this.isLongPress ? $r("app.color.folder_color_19182431") :
+ this.selectedFolderData.uuid == this.folderItem.uuid
+ ? $r("app.color.folder_color_ffffff") : "#00FFFFFF")
.bindContextMenu(this.menuBuilder, ResponseType.LongPress)
.bindContextMenu(this.menuBuilder, ResponseType.RightClick)
.onClick(() => {
@@ -475,8 +498,8 @@ struct FolderItemComp {
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())
- AppStorage.SetOrCreate('ContinueNote', continueNote)
- AppStorage.SetOrCreate('ContinueSection', 3)
+ AppStorage.setOrCreate('ContinueNote', continueNote)
+ AppStorage.setOrCreate('ContinueSection', 3)
LogUtil.info(this.TAG, "FolderItemComp, set continue note success")
}
NoteUtil.refreshAll()
@@ -489,7 +512,10 @@ struct FolderItemComp {
.objectFit(ImageFit.Fill)
.width(24)
.height(24)
- .fillColor(this.isUpdate ? FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid) : FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, this.selectedFolderData.uuid == this.folderItem.uuid))
+ .fillColor(this.isUpdate ? FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid,
+ this.selectedFolderData.uuid == this.folderItem.uuid) :
+ FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid,
+ this.selectedFolderData.uuid == this.folderItem.uuid))
.margin({ right: 16 })
Text(FolderUtil.getFolderText(this.folderItem))
.id(this.isUpdate + '')
@@ -514,8 +540,9 @@ struct FolderItemComp {
.borderRadius(12)
.height(56)
.padding({ left: 12, right: 12 })
- .backgroundColor(this.isLongPress ? $r("app.color.folder_color_19182431") : this.selectedFolderData.uuid == this.folderItem.uuid
- ? $r("app.color.folder_color_ffffff") : "#00FFFFFF")
+ .backgroundColor(this.isLongPress ? $r("app.color.folder_color_19182431") :
+ this.selectedFolderData.uuid == this.folderItem.uuid
+ ? $r("app.color.folder_color_ffffff") : "#00FFFFFF")
.onClick(() => {
if (this.longpress) {
this.longpress = false
diff --git a/features/src/main/ets/components/NoteContent.ets b/features/src/main/ets/components/NoteContent.ets
index 5b70e68..60c919d 100644
--- a/features/src/main/ets/components/NoteContent.ets
+++ b/features/src/main/ets/components/NoteContent.ets
@@ -99,7 +99,7 @@ export struct NoteContent {
callbackhtml: (html: string) => {
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid)
this.selectedNoteData.content_text = NoteUtil.contrastInitType(this.selectedNoteData.content_text);
- if (this.selectedNoteData.content_text === html ) {
+ if (this.selectedNoteData.content_text === html) {
return;
}
this.selectedNoteData.content_text = html
@@ -186,8 +186,12 @@ export struct NoteContent {
build() {
Stack({ alignContent: Alignment.Bottom }) {
- Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
- alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) {
+ Flex({
+ direction: FlexDirection.Column,
+ wrap: FlexWrap.NoWrap,
+ alignItems: ItemAlign.Start,
+ alignContent: FlexAlign.SpaceAround
+ }) {
Column() {
ToolBarComp({ controllerShow: this.controllerShow })
}.margin({ left: 24, right: 24 })
@@ -200,20 +204,12 @@ export struct NoteContent {
.javaScriptProxy({
object: this.noteContent,
name: "callBackToApp", // html--> name.method
- methodList: ["callbackhtml", "callbackScheduledSave", "callbackPasteImage", "callbackImagePath", "callbackGetSize"],
+ methodList: ["callbackhtml", "callbackScheduledSave", "callbackPasteImage", "callbackImagePath",
+ "callbackGetSize"],
controller: this.controllerShow
})
.onPageEnd((e) => {
- if (this.dpi <= 240) {
- this.controllerShow.runJavaScript("changeSizeToRk()")
- } else if (this.dpi <= 320 && this.dpi > 240) {
- this.controllerShow.runJavaScript("changeSizeToPhone()")
- } else {
- this.controllerShow.runJavaScript("changeSizeToTablet()")
- }
- if (AppStorage.Get('breakPoint') !== 'sm') {
- this.controllerShow.runJavaScript("hiddenButton()")
- }
+ this.controllerShow.runJavaScript("changeSizeToRk()")
LogUtil.info(TAG, "finish loadurl")
if (this.selectedNoteData) {
let self = this
@@ -289,9 +285,11 @@ export struct ToolBarComp {
@Consume('EditModel') editModel: boolean
controllerShow: webview.WebviewController = new webview.WebviewController();
editContentDialogCtl: CustomDialogController | null = new CustomDialogController({
- builder: EditContentDialog({ confirm: (newTitle: string) => {
- this.confirm(newTitle);
- } }),
+ builder: EditContentDialog({
+ confirm: (newTitle: string) => {
+ this.confirm(newTitle);
+ }
+ }),
alignment: DialogAlignment.Bottom,
autoCancel: true,
customStyle: true,
@@ -306,8 +304,12 @@ export struct ToolBarComp {
}
build() {
- Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap,
- justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
+ Flex({
+ direction: FlexDirection.Row,
+ wrap: FlexWrap.NoWrap,
+ justifyContent: FlexAlign.SpaceBetween,
+ alignItems: ItemAlign.Center
+ }) {
Image($r('app.media.narrow'))
.height(24)
.width(24)
@@ -334,11 +336,13 @@ export struct ToolBarComp {
if (this.editModel == false) {
Row({ space: StyleConstants.SPACE_24 }) {
- Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') : $r('app.media.favorite_cancel'))
+ Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') :
+ $r('app.media.favorite_cancel'))
.height(24).width(24)
.onClick(() => {
try {
- this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes)
+ this.selectedNoteData.is_favorite =
+ (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes)
// update note to db
let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable)
predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid)
@@ -485,9 +489,11 @@ export struct NoteContentOverViewComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('isUpdate') isUpdate: boolean = false
editTitleDialogCtl: CustomDialogController | null = new CustomDialogController({
- builder: EditTitleDialog({ confirm: (newTitle: string) => {
- this.confirm(newTitle);
- } }),
+ builder: EditTitleDialog({
+ confirm: (newTitle: string) => {
+ this.confirm(newTitle);
+ }
+ }),
alignment: DialogAlignment.Center,
autoCancel: false,
customStyle: true,
@@ -510,7 +516,8 @@ export struct NoteContentOverViewComp {
NoteUtil.refreshAll()
}
- @Builder MenuBuilder() {
+ @Builder
+ MenuBuilder() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
List() {
ForEach(this.AllFolderArray, (item: FolderData) => {
@@ -540,8 +547,12 @@ export struct NoteContentOverViewComp {
build() {
if (this.selectedNoteData) {
- Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap,
- justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
+ Flex({
+ direction: FlexDirection.Column,
+ wrap: FlexWrap.NoWrap,
+ justifyContent: FlexAlign.SpaceBetween,
+ alignItems: ItemAlign.Center
+ }) {
Row() {
Text(this.selectedNoteData.title)
.id(this.isUpdate + '')
@@ -562,9 +573,11 @@ export struct NoteContentOverViewComp {
.fontColor($r("app.color.modified_time_font_color"))
.margin({ left: 12 })
Row() {
- Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)) ==
+ Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'),
+ this.selectedNoteData.folder_uuid)) ==
folderTextMap.sys_def_myFavorites_uuid ? folderTextMap.sys_def_unClassified_uuid :
- FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid)))
+ FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'),
+ this.selectedNoteData.folder_uuid)))
.id(this.isUpdate + '')
.fontSize(12)
.fontColor($r("app.color.list_modified_time_font_color"))
@@ -573,10 +586,16 @@ export struct NoteContentOverViewComp {
.height(12)
.margin({ left: 4 })
}
- .padding({ left: 8, right: 8, top: 4, bottom: 4 })
+ .padding({
+ left: 8,
+ right: 8,
+ top: 4,
+ bottom: 4
+ })
.margin({ left: 8 })
.borderRadius(16)
- .backgroundColor(NoteUtil.getNoteBgColor(AppStorage.Get('AllFolderArray')!, this.selectedNoteData.folder_uuid, SysDefFolderUuid.AllNotes, false))
+ .backgroundColor(NoteUtil.getNoteBgColor(AppStorage.Get('AllFolderArray')!, this.selectedNoteData.folder_uuid,
+ SysDefFolderUuid.AllNotes, false))
.bindMenu(this.MenuBuilder)
}.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100)
}
@@ -591,7 +610,9 @@ export struct NoteContentOverViewComp {
struct NoteDataMoveItemComp {
@StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = []
@StorageLink('AllFolderArray') AllFolderArray: FolderData[] = []
- private folderItem: FolderData = new FolderData(0, '', new Date().getTime() + '', '', FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime());
+ private folderItem: FolderData =
+ new FolderData(0, '', new Date().getTime() + '', '', FolderType.CusDef, Delete.No, new Date().getTime(),
+ new Date().getTime());
build() {
Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) {
diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets
index 57e6753..34e9b0a 100644
--- a/features/src/main/ets/components/NoteContentComp.ets
+++ b/features/src/main/ets/components/NoteContentComp.ets
@@ -297,16 +297,7 @@ export struct NoteContentComp {
.onPageEnd((e) => {
try {
LogUtil.info(TAG, `dpi:${this.dpi}}`);
- if (this.dpi <= 240) {
- this.controllerShow.runJavaScript('changeSizeToRk()');
- } else if (this.dpi <= 320 && this.dpi > 240) {
- this.controllerShow.runJavaScript('changeSizeToPhone()');
- } else {
- this.controllerShow.runJavaScript('changeSizeToTablet()');
- }
- if (AppStorage.Get('breakPoint') !== 'sm') {
- this.controllerShow.runJavaScript('hiddenButton()');
- }
+ this.controllerShow.runJavaScript('changeSizeToRk()');
LogUtil.info(TAG, 'finish loadurl');
if (this.selectedNoteData) {
let self = this;
@@ -384,7 +375,7 @@ export struct NoteContentComp {
.id(this.isUpdate + '')
.height(StyleConstants.PERCENTAGE_100)
.visibility(FolderUtil.getNoteCount(AppStorage.get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ?
- Visibility.Hidden : Visibility.Visible)
+ Visibility.Hidden : Visibility.Visible)
Column() {
}
@@ -501,7 +492,8 @@ export struct NoteContentOverViewComp {
if (this.sectionStatus != 1) {
this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid)!;
LogUtil.info(TAG,
- 'NoteContentOverViewComp MenuBuilder onClick, runJavaScript(RICH_EDITOR.setHtml)' + this.selectedNoteData.content_text);
+ 'NoteContentOverViewComp MenuBuilder onClick, runJavaScript(RICH_EDITOR.setHtml)' +
+ this.selectedNoteData.content_text);
this.controllerShow.runJavaScript(
"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
)
@@ -509,7 +501,8 @@ export struct NoteContentOverViewComp {
} else {
this.selectedFolderData = FolderUtil.getFolderData(AppStorage.get('AllFolderArray')!, item.uuid);
LogUtil.info(TAG,
- 'NoteContentOverViewComp MenuBuilder onClick, selectedFolderData :' + JSON.stringify(this.selectedFolderData));
+ 'NoteContentOverViewComp MenuBuilder onClick, selectedFolderData :' +
+ JSON.stringify(this.selectedFolderData));
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject());
@@ -565,8 +558,8 @@ export struct NoteContentOverViewComp {
Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.get('AllFolderArray'),
this.selectedNoteData.folder_uuid)) ==
folderTextMap.sys_def_myFavorites_uuid ? folderTextMap.sys_def_unClassified_uuid :
- FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.get('AllFolderArray'),
- this.selectedNoteData.folder_uuid)))
+ FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.get('AllFolderArray'),
+ this.selectedNoteData.folder_uuid)))
.id(this.isUpdate + '')
.fontSize(12)
.fontColor($r('app.color.list_modified_time_font_color'))
@@ -754,7 +747,8 @@ export struct ToolBarComp {
LogUtil.info(TAG, 'ToolBarComp, onClick, recover note');
this.selectedNoteData.is_deleted = Delete.No;
this.selectedNoteData.deleted_time = 0;
- let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
+ let context: common.UIAbilityContext =
+ this.getUIContext().getHostContext() as common.UIAbilityContext;
let resource: resourceManager.Resource = {
bundleName: 'com.ohos.note',
moduleName: 'default',
@@ -842,7 +836,8 @@ export struct ToolBarComp {
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA',
];
- let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext;
+ let context: common.UIAbilityContext =
+ this.getUIContext().getHostContext() as common.UIAbilityContext;
let AtManager = abilityAccessCtrl.createAtManager();
await AtManager.requestPermissionsFromUser(context, permissionList).then((data) => {
LogUtil.info(TAG, 'ToolBarComp data permissions : ' + data.permissions);
@@ -974,7 +969,7 @@ export struct ToolBarComp {
} else {
Row({ space: StyleConstants.SPACE_24 }) {
Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') :
- $r('app.media.favorite_cancel'))
+ $r('app.media.favorite_cancel'))
.height(24)
.width(24)
.onClick(() => {
diff --git a/features/src/main/ets/components/NoteContentCompPortrait.ets b/features/src/main/ets/components/NoteContentCompPortrait.ets
index 8597794..68717cb 100644
--- a/features/src/main/ets/components/NoteContentCompPortrait.ets
+++ b/features/src/main/ets/components/NoteContentCompPortrait.ets
@@ -139,6 +139,7 @@ export struct NoteContentCompPortrait {
noteContent: NoteContentType = {
callbackhtml: (html) => {
+ LogUtil.info(TAG, 'callbackhtml: '+html);
LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData?.uuid);
this.selectedNoteData.content_text = NoteUtil.contrastInitType(this.selectedNoteData.content_text);
if (this.selectedNoteData.content_text === html) {
@@ -351,13 +352,7 @@ export struct NoteContentCompPortrait {
})
.onPageEnd((e) => {
try {
- if (this.dpi <= 240) {
- this.controllerShow.runJavaScript('changeSizeToRk()');
- } else if (this.dpi <= 320 && this.dpi > 240) {
- this.controllerShow.runJavaScript('changeSizeToPhone()');
- } else {
- this.controllerShow.runJavaScript('changeSizeToTablet()');
- }
+ this.controllerShow.runJavaScript('changeSizeToRk()');
LogUtil.info(TAG, 'finish loadurl');
let self = this;
LogUtil.info(TAG, 'onPageEnd setHtml start');
@@ -548,10 +543,10 @@ export struct NoteContentOverViewComp {
.padding({ top: 4, bottom: 4 })
.fontColor($r('app.color.modified_time_font_color'))
Row() {
- Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'),
+ Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.get('AllFolderArray'),
this.selectedNoteData?.folder_uuid)) ==
folderTextMap.sys_def_myFavorites_uuid ? folderTextMap.sys_def_unClassified_uuid :
- FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'),
+ FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.get('AllFolderArray'),
this.selectedNoteData?.folder_uuid)))
.id(this.isUpdate + '')
.fontColor($r('app.color.folder_color_99182431'))
diff --git a/features/src/main/ets/components/NoteListComp.ets b/features/src/main/ets/components/NoteListComp.ets
index 25fd24b..fd55a23 100644
--- a/features/src/main/ets/components/NoteListComp.ets
+++ b/features/src/main/ets/components/NoteListComp.ets
@@ -235,7 +235,7 @@ struct NoteOverViewComp {
@State isShow: boolean = false
notesNumberChange() {
- let noteNumbers = FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray')!, this.selectedFolderData.uuid);
+ let noteNumbers = FolderUtil.getNoteCount(AppStorage.get('AllNoteArray')!, this.selectedFolderData.uuid);
if (noteNumbers == 0) {
this.isShow = false
} else {
@@ -259,17 +259,9 @@ struct NoteOverViewComp {
.margin({ right: 24 }) // 两分栏时缩进图片与右边有个24的间距
.visibility(this.breakPoints == 'lg' && this.sectionStatus == 3 ? Visibility.None : Visibility.Visible)
.onClick(() => {
- if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
- this.getUIContext().animateTo({ duration: 200 }, () => {
- this.expandStatus = !this.expandStatus
- })
- } else {
- this.asideWidth = 200
- this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3)
- // save continue data
- AppStorage.setOrCreate('ContinueSection', this.sectionStatus)
- LogUtil.info(TAG, "NoteOverViewComp, set continue section success")
- }
+ this.getUIContext().animateTo({ duration: 200 }, () => {
+ this.expandStatus = !this.expandStatus
+ })
})
}.alignItems(HorizontalAlign.Center)
@@ -317,7 +309,7 @@ struct NoteOverViewComp {
NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray)
})
Text(this.CheckedNoteArray.length == 0 ? $r("app.string.none_selected") :
- $r("app.string.selected", this.CheckedNoteArray.length))
+ $r("app.string.selected", this.CheckedNoteArray.length))
.fontSize(20)
.fontColor($r("app.color.note_selected_font_color"))
.margin({ left: 16 })
@@ -359,11 +351,11 @@ export struct NoteItemComp {
@Consume('selectedAll') selectedAll: boolean
@Consume('PortraitModel') portraitModel: boolean
@State isChecked: boolean = false;
- @Consume('Longpress') @Watch('isLongPress') longpress: boolean
+ @Consume('Longpress') @Watch('isLongPress') longPress: boolean
@StorageLink('isUpdate') isUpdate: boolean = false
isLongPress() {
- if (this.longpress) {
+ if (this.longPress) {
this.isChecked = false
}
}
@@ -433,11 +425,11 @@ export struct NoteItemComp {
.id(this.isUpdate + '')
}.width(24)
.height(24)
- .visibility(this.longpress ? Visibility.Visible : Visibility.None)
+ .visibility(this.longPress ? Visibility.Visible : Visibility.None)
}
.flexShrink(0)
.height(48)
- .width(this.longpress ? 80 : 48)
+ .width(this.longPress ? 80 : 48)
}
.width('100%')
.height(72)
@@ -459,7 +451,7 @@ export struct NoteItemComp {
AppStorage.setOrCreate('Search', this.search)
return
}
- if (this.longpress) {
+ if (this.longPress) {
if (NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)) {
NoteUtil.unsetNoteChecked(this.CheckedNoteArray, this.noteItem)
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
@@ -495,12 +487,12 @@ export struct NoteItemComp {
}
}
if (this.portraitModel == true) {
- AppStorage.SetOrCreate('NewNote', this.selectedNoteData)
- AppStorage.SetOrCreate('NewFolder', this.selectedFolderData)
+ AppStorage.setOrCreate('NewNote', this.selectedNoteData)
+ AppStorage.setOrCreate('NewFolder', this.selectedFolderData)
routePage()
}
this.selectedAll = this.CheckedNoteArray.length ==
- NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray')!, this.selectedFolderData.uuid).length;
+ NoteUtil.getNoteDataArray(AppStorage.get('AllNoteArray')!, this.selectedFolderData.uuid).length;
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
})
.gesture(
@@ -508,8 +500,8 @@ export struct NoteItemComp {
// 长按:对笔记列表进行操作
LongPressGesture()
.onAction(() => {
- if (this.longpress == false) {
- this.longpress = true
+ if (this.longPress == false) {
+ this.longPress = true
NoteUtil.setNoteChecked(this.CheckedNoteArray, this.noteItem)
this.isChecked = NoteUtil.isNoteChecked(this.CheckedNoteArray, this.noteItem)
}
@@ -574,7 +566,7 @@ export struct NoteItemListComp {
}
// save continue data
let continueNote: string = JSON.stringify(this.selectedNoteData?.toNoteObject())
- AppStorage.SetOrCreate('ContinueNote', continueNote)
+ AppStorage.setOrCreate('ContinueNote', continueNote)
LogUtil.info(TAG, "doSearch, set continue note success")
this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0)
})
@@ -596,7 +588,7 @@ export struct NoteItemListComp {
.width("100%")
.padding({ left: 24, right: 24, bottom: 12 })
.visibility((FolderUtil.getNoteCount(AppStorage.get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ?
- Visibility.None : Visibility.Visible)
+ Visibility.None : Visibility.Visible)
Stack() {
Flex({ direction: FlexDirection.Column }) {
@@ -609,7 +601,7 @@ export struct NoteItemListComp {
.width('100%')
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes
&& FolderUtil.getNoteCount(AppStorage.get('AllNoteArray'), this.selectedFolderData.uuid) > 0 ?
- Visibility.Visible : Visibility.None)
+ Visibility.Visible : Visibility.None)
Column() {
List({ initialIndex: 0 }) {
@@ -628,7 +620,7 @@ export struct NoteItemListComp {
.height('100%')
.padding({ bottom: 120 })
.visibility((FolderUtil.getNoteCount(AppStorage.get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ?
- Visibility.Visible : Visibility.None)
+ Visibility.Visible : Visibility.None)
LazyForEach(this.noteList, (noteItem: NoteData) => {
ListItem() {
@@ -654,7 +646,7 @@ export struct NoteItemListComp {
.layoutWeight(1)
.listDirection(Axis.Vertical)
.edgeEffect(EdgeEffect.Spring)
- .cachedCount(10)
+ .cachedCount(2)
}
.layoutWeight(1)
.height("100%")
@@ -784,7 +776,7 @@ export struct OperateNoteComp {
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 18 })
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None :
- Visibility.Visible)
+ Visibility.Visible)
.onClick(() => {
this.CheckedNoteArray.forEach((noteItem) => {
noteItem.is_top = (noteItem.is_top == Top.Yes) ? Top.No : Top.Yes
@@ -804,7 +796,7 @@ export struct OperateNoteComp {
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 0 : 18 })
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None :
- Visibility.Visible)
+ Visibility.Visible)
.onClick(() => {
this.noteDataMoveDialogCtl!.open();
})
@@ -824,7 +816,7 @@ export struct OperateNoteComp {
.enabled(this.CheckedNoteArray.length == 0 ? false : true)
.margin({ right: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 18 : 0 })
.visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible :
- Visibility.None)
+ Visibility.None)
.onClick(() => {
this.CheckedNoteArray.forEach((noteItem) => {
noteItem.is_deleted = Delete.No
@@ -942,7 +934,7 @@ export struct AddNoteComp {
routePage()
})
.visibility(this.longpress || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None :
- Visibility.Visible)
+ Visibility.Visible)
}
}
@@ -984,7 +976,7 @@ export struct SearchComp {
.defaultFocus(true)
TextInput({ placeholder: $r('app.string.searchNote'), text: this.text })
.backgroundColor(this.longpress ? $r("app.color.search_longpress_bgcolor_f7f8f9") :
- $r("app.color.color_ffffff"))
+ $r("app.color.color_ffffff"))
.caretColor($r("app.color.search_note_caret_color"))
.enabled(this.longpress ? false : true)
.padding({
@@ -1261,7 +1253,7 @@ export struct OperateNoteCompForPortrait {
if (error != null) {
LogUtil.error(TAG, "error is " + error);
} else {
- this.getUIContext().getPromptAction().showToast({ message: value, duration: 2000 });
+ this.getUIContext().getPromptAction().showToast({ message: value, duration: 2000 });
}
});
// update note to db
diff --git a/product/default/src/main/ets/pages/MyNoteHome.ets b/product/default/src/main/ets/pages/MyNoteHome.ets
index 52ab8c7..3e90c29 100644
--- a/product/default/src/main/ets/pages/MyNoteHome.ets
+++ b/product/default/src/main/ets/pages/MyNoteHome.ets
@@ -14,15 +14,14 @@
*/
import fileio from '@ohos.fileio'
-import { NoteHomeComp } from './NoteHome'
import { NoteHomePortraitComp } from './NoteHomePortrait'
import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil'
import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil'
-import inputMethod from '@ohos.inputMethod';
-import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
-import webview from '@ohos.web.webview';
-import { BusinessError } from '@ohos.base';
-import common from '@ohos.app.ability.common';
+import inputMethod from '@ohos.inputMethod'
+import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
+import webview from '@ohos.web.webview'
+import { BusinessError } from '@ohos.base'
+import common from '@ohos.app.ability.common'
@Entry
@Component
@@ -39,11 +38,7 @@ export struct MyNoteHomeComp {
onBreakPointChange() {
LogUtil.info(this.TAG, "onBreakPointChange, breakPoints = "+this.breakPoints)
- if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
- this.portraitModel = true
- } else {
- this.portraitModel = false
- }
+ this.portraitModel = true
}
build() {
@@ -54,12 +49,7 @@ export struct MyNoteHomeComp {
.height(this.getUIContext().px2vp(this.topHeight))
Row() {
if (this.dBQueryFinished == 1) {
- if (this.breakPoints == 'sm') {
NoteHomePortraitComp()
- } else {
- NoteHomeComp({ controllerShow: this.controllerShow })
- }
-
}
}
.width('100%')
@@ -70,11 +60,7 @@ export struct MyNoteHomeComp {
aboutToAppear(): void {
LogUtil.info(this.TAG, "aboutToAppear")
this.breakPoints = AppStorage.get('breakPoint')!;
- if (this.breakPoints == 'sm' || this.breakPoints == 'md') {
- this.portraitModel = true
- } else {
- this.portraitModel = false
- }
+ this.portraitModel = true
if (this.context == undefined || this.context == null) {
LogUtil.warn(this.TAG, "context is error")
return
diff --git a/product/default/src/main/ets/pages/NoteContentHome.ets b/product/default/src/main/ets/pages/NoteContentHome.ets
index 8736507..5f146e7 100644
--- a/product/default/src/main/ets/pages/NoteContentHome.ets
+++ b/product/default/src/main/ets/pages/NoteContentHome.ets
@@ -36,12 +36,7 @@ struct NoteContentHome {
// Note content display area
Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) {
if (this.dBQueryFinished == 1) {
- if (this.breakPoints == 'sm') {
- NoteContentCompPortrait({ controllerShow: this.controllerShow })
- } else {
- NoteContent({ controllerShow: this.controllerShow })
- }
-
+ NoteContentCompPortrait({ controllerShow: this.controllerShow })
}
}
.backgroundColor($r("app.color.notecontent_color_ffffff"))
diff --git a/product/default/src/main/ets/pages/NoteHome.ets b/product/default/src/main/ets/pages/NoteHome.ets
index e9cb339..182a244 100644
--- a/product/default/src/main/ets/pages/NoteHome.ets
+++ b/product/default/src/main/ets/pages/NoteHome.ets
@@ -28,15 +28,15 @@ import webview from '@ohos.web.webview';
@Component
export struct NoteHomeComp {
// 当前文件夹、笔记、分栏
- @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder')!;
- @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note')!;
- @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section')!;
+ @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.get('Folder')!;
+ @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.get('Note')!;
+ @Provide('SectionStatus') sectionStatus: number = AppStorage.get('Section')!;
@Provide('SelectedColor') selectedColor: string = circleColorArray[0]
@Provide('LastSectionStatus') lastSectionStatus: number = 3 // 记录分栏上一次的状态
@Provide('Longpress') longpress: boolean = false // 第二栏长按状态
@Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态
@Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开
- @Provide('Search') search: boolean = AppStorage.Get('Search')!; // 是否处于搜索状态
+ @Provide('Search') search: boolean = AppStorage.get('Search')!; // 是否处于搜索状态
@Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表
@Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串
@Provide('SelectedAll') selectedAll: boolean = false
@@ -173,7 +173,7 @@ export struct NoteHomeComp {
this.sectionStatus = 1
}
// save continue data
- AppStorage.SetOrCreate('ContinueSection', this.sectionStatus)
+ AppStorage.setOrCreate('ContinueSection', this.sectionStatus)
LogUtil.info(this.TAG, "aboutToAppear, set continue section success")
}
diff --git a/product/default/src/main/ets/pages/NoteHomePortrait.ets b/product/default/src/main/ets/pages/NoteHomePortrait.ets
index 5b2923e..d1f0677 100644
--- a/product/default/src/main/ets/pages/NoteHomePortrait.ets
+++ b/product/default/src/main/ets/pages/NoteHomePortrait.ets
@@ -64,15 +64,16 @@ export struct NoteHomePortraitComp {
.backgroundColor(Color.Black)
.opacity(0.2)
.transition({ opacity: 0 })
+ //Folder list display area
+ Column() {
+ FolderListComp()
+ }
+ .width(200)
+ .height(StyleConstants.PERCENTAGE_100)
+ .position({ x: 0, y: 0 })
+ .translate({ x: this.expandStatus ? 0 : '-200', y: 0 })
}
- //Folder list display area
- Column() {
- FolderListComp()
- }
- .width(200)
- .height(StyleConstants.PERCENTAGE_100)
- .position({ x: 0, y: 0 })
- .translate({ x: this.expandStatus ? 0 : '-200', y: 0 })
+
}
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
}