diff --git a/jsconfig.json b/jsconfig.json
index 4aafc5f..011c747 100644
--- a/jsconfig.json
+++ b/jsconfig.json
@@ -3,6 +3,7 @@
"target": "es5",
"module": "esnext",
"baseUrl": "./",
+ "jsx": "preserve",
"moduleResolution": "node",
"paths": {
"@/*": [
diff --git a/package.json b/package.json
index 87f3d6e..d1e8a0d 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,6 @@
"crypto-js": "^4.1.1",
"escape-html": "^1.0.3",
"file-saver": "^2.0.5",
- "html2canvas": "^1.4.1",
"jquery": "^3.6.0",
"nprogress": "^0.2.0",
"pako": "^2.0.4",
@@ -23,6 +22,7 @@
"view-design": "^4.0.0",
"vue": "^2.6.14",
"vue-axios": "^3.4.1",
+ "vue-contextmenu": "^1.5.11",
"vue-i18n": "^8.27.2",
"vue-router": "^3.5.1"
},
diff --git a/public/IeIsNotSupported.html b/public/IeIsNotSupported.html
index 2b7e0d6..f43d1fb 100644
--- a/public/IeIsNotSupported.html
+++ b/public/IeIsNotSupported.html
@@ -4,7 +4,11 @@
-
+
+
+
+
+
flagnote.com
+
-
+
+
-
@@ -183,11 +140,7 @@
-
-
-
-
+ @on-keydown="down" />
@@ -212,13 +165,14 @@
Content of dialog
-
+
- {{$t("message.askTodelete")}}
+ {{ $t("message.askTodelete") }}
-
+
@@ -265,46 +219,58 @@ export default {
locking: 0,
commited: 0
},
- model:{
+ model: {
showDelete: false,
deleting: false,
showDownloadText: false,
},
- toTopState : false,
+ toTopState: false,
}
},
created() {
-
- this.model.showDownloadText = !isWeixin();
-
+ // read $route
this.noteForm.key = this.$route.params.name;
let keyMeta = this.$route.meta.keyMeta;
+
+ //ipad chrome url not redirect
+ let path = location.pathname;
+ if ("/" == path) {
+ history.pushState('', '', '/' + this.noteForm.key);
+ }
+
+ //wx does not show downloadText
+ this.model.showDownloadText = !isWeixin();
+
// let noteMeta = this.$route.meta.noteMeta;
let storeKey = getStoreKey(this.noteForm.key);
this.secret.storeKey = storeKey;
+ // first edit
if (keyMeta) {
this.state.lock = 0;
this.secret.cipher = keyMeta.cipher;
this.secret.currentTime = keyMeta.currentTime;
+ // key init Time
this.noteForm.initTime = keyMeta.currentTime;
- storage.local.setText(storeKey + '.text', "0|" + this.secret.cipher + "|0|" + this.secret.currentTime + "|");
- storage.session.setObject(storeKey + '.keyMeta', null);
- storage.local.dynamicClear(this.secret.currentTime);
+ // clear
+ storage.local.dynamicClear();
+
+ //if local less 1m ,then deep clear,let local greater than 2m
+ // if (storage.local.getAvailableSize < 1 * 1024 * 1024) {
+ // storage.local.dynamicDeepClear(this.secret.currentTime, storeKey);
+ // }
+
+ storage.local.setText(storeKey + '.text', "0|" + this.secret.cipher + "|0|" + this.noteForm.initTime + "|");
} else {
+ // second edit
let storeText = storage.local.getText(storeKey + '.text');
let starray = storeText.split('|');
this.state.lock = parseInt(starray[0]);
this.secret.cipher = starray[1];
this.noteForm.initTime = parseInt(starray[3]);
-
-
- // this.secret.currentTime = noteMeta.currentTime;
- // storage.local.dynamicClear(this.secret.currentTime);
}
-
-
+ //TODO: password lock
if (this.state.lock == 1) {
this.show = false;
this.noteForm.text = "*****lock*****";
@@ -313,34 +279,9 @@ export default {
this.loadText();
}
+ this.bindCtrlAllEvent();
- this.bindEvent();
-
-
-
-
- let that = this;
- window.onscroll = function () {
- //变量scrollTop是滚动条滚动时,距离顶部的距离
- var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
- // //变量windowHeight是可视区的高度
- // var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
- // //变量scrollHeight是滚动条的总高度
- // var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
- //滚动条到底部的条件
-
- if (scrollTop >= 20) {
- //写后台加载数据的函数
- //console.log("距顶部" + scrollTop + "可视区高度" + windowHeight + "滚动条总高度" + scrollHeight);
-
- that.toTopState = true;
- } else {
- //toTop.style.setProperty("display", "none")
- that.toTopState = false;
- }
- }
-
-
+ this.bindToTopEvent();
@@ -349,6 +290,20 @@ export default {
},
mounted() {
+ const myObserver = new ResizeObserver(entries => {
+ // iterate over the entries, do something.
+ entries.forEach(entry => {
+ let affix = document.querySelector('.ivu-affix');
+ if (affix) {
+ affix.setAttribute("style", "top: 0px; width: " + entry.contentRect.width + "px;");
+ }
+
+ });
+ });
+
+ const someOtherEl = document.querySelector('#wrapper');
+
+ myObserver.observe(someOtherEl);
},
updated() {
},
@@ -359,8 +314,13 @@ export default {
computed: {},
watch: {},
methods: {
- toTop(){
- window.scrollTo(0, 0);
+
+ toTop() {
+ window.scrollTo(0, 0);
+ let elent = document.querySelector('#noteText');
+ elent.selectionStart = 0;
+ elent.selectionEnd = 0;
+ elent.focus();
},
showInput() {
this.showPassword = true;
@@ -377,16 +337,15 @@ export default {
cancel() {
},
- downLoadText(){
- var blob = new Blob([this.noteForm.text], {type: "application/octet-stream;charset=utf-8"});
- saveAs(blob, this.noteForm.key+".txt");
+ downLoadText() {
+ var blob = new Blob([this.noteForm.text], { type: "application/octet-stream;charset=utf-8" });
+ saveAs(blob, this.noteForm.key + ".txt");
},
loadText() {
- let secretKey = getSecretKey(this.noteForm.key);
let storeText = storage.local.getText(this.secret.storeKey + '.text');
if (null != storeText && '' != storeText) {
-
+
let starray = storeText.split('|');
let lock = parseInt(starray[0]);
@@ -395,12 +354,11 @@ export default {
return;
}
- //let cipher = storeText.substring(2,34)
-
storeText = starray[4];
if (storeText.length > 0) {
storeText = unzip(storeText);
+ let secretKey = getSecretKey(this.noteForm.key);
let plainText = aesDecrypt(storeText, secretKey);
if (plainText.startsWith("FLAGNOTE#")) {
this.noteForm.text = plainText.substring(9);
@@ -421,9 +379,10 @@ export default {
},
down(event) {
if (event.keyCode == 9) {
- let start = event.currentTarget.selectionStart, end = event.currentTarget.selectionEnd;
+ let start = event.currentTarget.selectionStart;
+ let end = event.currentTarget.selectionEnd;
let text = event.currentTarget.value;
- let tab = ' ';//\t
+ let tab = '\t';//\t
text = text.substr(0, start) + tab + text.substr(start);
event.currentTarget.value = text;
event.currentTarget.selectionStart = start + tab.length;
@@ -435,21 +394,14 @@ export default {
this.noteForm.text = event.currentTarget.value;
setStoreText(this.noteForm, this.secret);
- // html2canvas(document.body).then(function (canvas) {
- // canvas;
- // //document.body.appendChild(canvas);
- // });
-
} else if (event.ctrlKey && (event.which == 13)) {
-
+ //save
let that = this;
this.save().then(res => {
if (res) {
-
let storeText = storage.local.getText(that.secret.storeKey + '.text');
let starray = storeText.split("|");
- storage.local.setText(that.secret.storeKey + '.text', starray[0] + '|' + starray[1] + '|1|'+ starray[3] +'|' + starray[4]);
-
+ storage.local.setText(that.secret.storeKey + '.text', starray[0] + '|' + starray[1] + '|1|' + starray[3] + '|' + starray[4]);
location.reload();
}
});
@@ -473,7 +425,7 @@ export default {
if (res) {
let storeText = storage.local.getText(that.secret.storeKey + '.text');
let starray = storeText.split("|");
- storage.local.setText(that.secret.storeKey + '.text', starray[0] + '|' + starray[1] + '|1|'+ starray[3] +'|' + starray[4]);
+ storage.local.setText(that.secret.storeKey + '.text', starray[0] + '|' + starray[1] + '|1|' + starray[3] + '|' + starray[4]);
location.reload();
this.state.locking = 0;
}
@@ -588,7 +540,20 @@ export default {
location.reload();
},
- bindEvent() {
+ bindToTopEvent() {
+ let that = this;
+ window.onscroll = function () {
+ var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
+ if (scrollTop >= 20) {
+ that.toTopState = true;
+ } else {
+ that.toTopState = false;
+ }
+
+ //document.getElementsByClassName("ivu-affix")[0]
+ }
+ },
+ bindCtrlAllEvent() {
if (document.body.createTextRange) {
Jquery(document).keydown(function (e) {
if ((e.ctrlKey || e.metaKey) && e.keyCode == 65) {
diff --git a/src/views/ViewNote.vue b/src/views/ViewNote.vue
index 46aef87..ede52dd 100644
--- a/src/views/ViewNote.vue
+++ b/src/views/ViewNote.vue
@@ -62,12 +62,65 @@
.layout-footer-center {
display: none;
}
+
+
}