蓝黄代码同步

Signed-off-by: @two-thousand-or-three-thousand <lisiquan1@huawei.com>
This commit is contained in:
@two-thousand-or-three-thousand 2022-12-19 18:26:09 +08:00
parent 668a56a87f
commit 76add7e139
7 changed files with 26 additions and 40 deletions

View File

@ -1,12 +1,10 @@
# 备忘录部件 # 备忘录部件
## 简介
## 1. 项目介绍
备忘录应用是OpenHarmony中预置的应用为用户提供文本编辑以及保存功能。 备忘录应用是OpenHarmony中预置的应用为用户提供文本编辑以及保存功能。
**架构图** ## 2. 目录结构
![](./figures/note.png)
## 目录
``` ```
/applications/standard/note /applications/standard/note
├─common ├─common
@ -47,10 +45,20 @@
└─resources # 资源文件 └─resources # 资源文件
``` ```
### 整体架构
![](./figures/note.png)
## 3. 签名打包
## 编译构建/使用方法
### 签名 ### 签名
#### 签名文件的获取
1.生成签名文件可参考https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/hapsigntool-overview.md
#### 签名文件的配置 #### 签名文件的配置
打开项目工程,选择 File → Project Structure 打开项目工程,选择 File → Project Structure
![](./figures/signature_1.png) ![](./figures/signature_1.png)
@ -74,6 +82,7 @@
![](./figures/ds_ohosbuild_output_dir_release.png) ![](./figures/ds_ohosbuild_output_dir_release.png)
## 4. 安装、调试
### 应用安装 ### 应用安装
@ -81,9 +90,6 @@
![](./figures/install.png) ![](./figures/install.png)
### 应用调试 ### 应用调试
#### log打印 #### log打印

View File

@ -16,9 +16,7 @@
<div class="edit-box"> <div class="edit-box">
<div id="editorjs" contenteditable="true"> <div id="editorjs" contenteditable="true"></div>
</div>
<div class="button-box" id="buttonBox"> <div class="button-box" id="buttonBox">
<div id="addToDo"> <div id="addToDo">
<img id="img1" src="../base/media/todo1.svg"> <img id="img1" src="../base/media/todo1.svg">

View File

@ -428,7 +428,7 @@ RICH_EDITOR.insertImageHtml = function (contents) {
selection.getRangeAt(0).insertNode(img); selection.getRangeAt(0).insertNode(img);
}; };
document.getElementById('addToDo').addEventListener('click', (e) => { document.addEventListener('click', (e) => {
console.info(`lsq: e is ${JSON.stringify(e)}`) console.info(`lsq: e is ${JSON.stringify(e)}`)
if (e.id !== 'editorjs') { if (e.id !== 'editorjs') {
e.preventDefault() e.preventDefault()
@ -444,7 +444,6 @@ document.getElementById('chooseStyle').addEventListener('click', () => {
}) })
document.getElementById('openAlbum').addEventListener('click', () => { document.getElementById('openAlbum').addEventListener('click', () => {
RICH_EDITOR.getFocus()
callBackToApp.openAlbum() callBackToApp.openAlbum()
}) })

View File

@ -99,7 +99,6 @@ export struct NewOrEditFolderDialog {
.width('48%') .width('48%')
.onClick(() => { .onClick(() => {
this.newOrEditFolderDialogCtl.close() this.newOrEditFolderDialogCtl.close()
// @ts-ignore
inputMethod.getController().stopInputSession(); inputMethod.getController().stopInputSession();
}) })
Divider() Divider()
@ -123,7 +122,6 @@ export struct NewOrEditFolderDialog {
.onClick(() => { .onClick(() => {
this.newOrEditFolderDialogCtl.close() this.newOrEditFolderDialogCtl.close()
this.confirm(this.selectedColor, this.inputName) this.confirm(this.selectedColor, this.inputName)
// @ts-ignore
inputMethod.getController().stopInputSession(); inputMethod.getController().stopInputSession();
}) })
}.width('100%') }.width('100%')
@ -697,7 +695,6 @@ export struct EditTitleDialog {
.width('48%') .width('48%')
.onClick(() => { .onClick(() => {
this.editTitleDialog.close() this.editTitleDialog.close()
// @ts-ignore
inputMethod.getController().stopInputSession(); inputMethod.getController().stopInputSession();
}) })
Divider() Divider()
@ -714,7 +711,6 @@ export struct EditTitleDialog {
.width('48%') .width('48%')
.onClick(() => { .onClick(() => {
this.editTitleDialog.close() this.editTitleDialog.close()
// @ts-ignore
inputMethod.getController().stopInputSession(); inputMethod.getController().stopInputSession();
if (this.inputName.replace(/\s+/g, '') == '') { if (this.inputName.replace(/\s+/g, '') == '') {
return return

View File

@ -252,8 +252,8 @@ export struct NoteContent {
} }
aboutToDisappear(): void { aboutToDisappear(): void {
NoteUtil.refreshAll()
AppStorage.Set("refreshCurrentNote", true) AppStorage.Set("refreshCurrentNote", true)
NoteUtil.refreshAll()
clearInterval(timeID) clearInterval(timeID)
LogUtil.info(TAG, "aboutToDisappear") LogUtil.info(TAG, "aboutToDisappear")
} }

View File

@ -228,10 +228,10 @@ export struct NoteContentCompPortrait {
alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) { alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) {
Column() { Column() {
ToolBarComp({ controllerShow: this.controllerShow }) ToolBarComp({ controllerShow: this.controllerShow })
NoteContentOverViewComp()
} }
Column() { Column() {
NoteContentOverViewComp()
Web({ src: $rawfile('editor.html'), controller: this.controllerShow }) Web({ src: $rawfile('editor.html'), controller: this.controllerShow })
.javaScriptAccess(true) .javaScriptAccess(true)
.javaScriptProxy({ .javaScriptProxy({
@ -272,7 +272,6 @@ export struct NoteContentCompPortrait {
this.storeScrollTop(event.yOffset) this.storeScrollTop(event.yOffset)
}) })
} }
.enabled(this.selectedNoteData && this.selectedNoteData.is_deleted == Delete.Yes ? false : true)
.flexShrink(1) .flexShrink(1)
.onClick(() => { .onClick(() => {
if (time_id) { if (time_id) {
@ -464,7 +463,6 @@ export struct ToolBarComp {
.width(24) .width(24)
.responseRegion({ width: 54, height: 54 }) .responseRegion({ width: 54, height: 54 })
.onClick(() => { .onClick(() => {
inputMethod.getController().stopInputSession()
this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
// 清除定时器 // 清除定时器
if (time_id != undefined) { if (time_id != undefined) {
@ -534,7 +532,6 @@ export struct ToolBarComp {
Button({ type: ButtonType.Normal, stateEffect: true }) { Button({ type: ButtonType.Normal, stateEffect: true }) {
Image($r('app.media.tick_thin')).height(24).width(24) Image($r('app.media.tick_thin')).height(24).width(24)
.onClick(() => { .onClick(() => {
inputMethod.getController().stopInputSession()
// 保存笔记信息到数据库 // 保存笔记信息到数据库
this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) this.controllerShow.runJavaScript({ script: "getHtmlContent()" })
this.editModel = false this.editModel = false

View File

@ -60,23 +60,13 @@ export struct NoteHomePortraitComp {
.backgroundColor($r("app.color.notelist_bgcolor_f1f3f5")) .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5"))
//Folder list display area //Folder list display area
Row() { Stack() {
Stack() { FolderListBackGround()
FolderListBackGround() FolderListComp()
FolderListComp()
}
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible)
Column() {
}
.height("100%")
.width("100%")
.backgroundColor("#18181A")
.opacity(0.2)
.visibility(this.expandStatus ? Visibility.Visible : Visibility.None)
} }
.width(200)
.height(StyleConstants.PERCENTAGE_100)
.visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible)
} }
.width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100)
} }