Compare commits
21 Commits
609ca4d3f5
...
retheme
Author | SHA1 | Date | |
---|---|---|---|
bc0a036aea | |||
b05e2d3c55 | |||
ae5257b2b3 | |||
c3f9529feb | |||
93b272ecb5 | |||
22e6cacd8e | |||
c52e08afa9 | |||
60b238d42e | |||
14dec9ce96 | |||
d67a51f83b | |||
bb1f98761d | |||
0b56f9b1a8 | |||
560828f4a2 | |||
32094f3a79 | |||
d46223c96a | |||
ffe1dd6f9f | |||
311409d36d | |||
31d9f99b77 | |||
7917a628ef | |||
cb6d5cd944 | |||
b54fbe2059 |
1321
package-lock.json
generated
1321
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
27
package.json
27
package.json
@ -14,39 +14,40 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hibas123/secure-file-wrapper": "^2.5.0",
|
"@hibas123/secure-file-wrapper": "^2.5.0",
|
||||||
|
"@hibas123/theme": "^1.0.6",
|
||||||
"@hibas123/utils": "^2.1.0",
|
"@hibas123/utils": "^2.1.0",
|
||||||
"aes-js": "^3.1.2",
|
"aes-js": "^3.1.2",
|
||||||
"feather-icons": "^4.21.0",
|
"easymde": "^2.6.1",
|
||||||
"idb": "3.0.2",
|
"feather-icons": "^4.22.1",
|
||||||
|
"idb": "^4.0.3",
|
||||||
"js-sha256": "^0.9.0",
|
"js-sha256": "^0.9.0",
|
||||||
"js-sha512": "^0.8.0",
|
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"secure-file-wrapper": "git+https://git.stamm.me/OpenServer/OSSecureFileWrapper.git",
|
"secure-file-wrapper": "git+https://git.stamm.me/OpenServer/OSSecureFileWrapper.git",
|
||||||
"uikit": "^3.1.5",
|
|
||||||
"uuid": "^3.3.2"
|
"uuid": "^3.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/codemirror": "0.0.76",
|
||||||
"@types/lodash.clonedeep": "^4.5.6",
|
"@types/lodash.clonedeep": "^4.5.6",
|
||||||
"@types/uikit": "^2.27.7",
|
"@types/uikit": "^2.27.7",
|
||||||
"@types/uuid": "^3.4.4",
|
"@types/uuid": "^3.4.5",
|
||||||
"copy-webpack-plugin": "^5.0.3",
|
"copy-webpack-plugin": "^5.0.3",
|
||||||
"css-loader": "^2.1.1",
|
"css-loader": "^3.0.0",
|
||||||
"file-loader": "^3.0.1",
|
"file-loader": "^4.0.0",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"mini-css-extract-plugin": "^0.7.0",
|
"mini-css-extract-plugin": "^0.7.0",
|
||||||
"node-sass": "^4.12.0",
|
"node-sass": "^4.12.0",
|
||||||
"preact": "^8.3.1",
|
"preact": "^8.3.1",
|
||||||
"preact-svg-loader": "^0.2.1",
|
"preact-svg-loader": "^0.2.1",
|
||||||
|
"raw-loader": "^3.0.0",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^7.1.0",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
"ts-loader": "^6.0.2",
|
"ts-loader": "^6.0.4",
|
||||||
"typescript": "^3.5.1",
|
"typescript": "^3.5.2",
|
||||||
"webpack": "^4.32.2",
|
"webpack": "^4.35.2",
|
||||||
"webpack-bundle-analyzer": "^3.3.2",
|
"webpack-bundle-analyzer": "^3.3.2",
|
||||||
"webpack-cli": "^3.3.2",
|
"webpack-cli": "^3.3.5",
|
||||||
"webpack-dev-server": "^3.5.0",
|
"webpack-dev-server": "^3.7.2",
|
||||||
"webpack-visualizer-plugin": "^0.1.11",
|
"webpack-visualizer-plugin": "^0.1.11",
|
||||||
"workbox-webpack-plugin": "^4.3.1",
|
|
||||||
"worker-loader": "^2.0.0"
|
"worker-loader": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3313
public/encoding.js
Normal file
3313
public/encoding.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,10 +3,9 @@
|
|||||||
"name": "Secure Notes",
|
"name": "Secure Notes",
|
||||||
"decription": "A place to store your notes securly",
|
"decription": "A place to store your notes securly",
|
||||||
"share_target": {
|
"share_target": {
|
||||||
"url_template": "/#/share?title={title}&text={text}&url={url}",
|
"action": "/share",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"enctype": "application/x-www-form-urlencoded",
|
"enctype": "application/x-www-form-urlencoded",
|
||||||
"action": "/",
|
|
||||||
"params": {
|
"params": {
|
||||||
"title": "title",
|
"title": "title",
|
||||||
"text": "text",
|
"text": "text",
|
||||||
@ -51,6 +50,6 @@
|
|||||||
],
|
],
|
||||||
"start_url": "/",
|
"start_url": "/",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"theme_color": "#e188e5",
|
"theme_color": "#1E88E5",
|
||||||
"background_color": "#ffffff"
|
"background_color": "#ffffff"
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ const CACHE = "offline";
|
|||||||
|
|
||||||
let precacheFiles = [
|
let precacheFiles = [
|
||||||
"/",
|
"/",
|
||||||
|
"/index.html",
|
||||||
"/main.js",
|
"/main.js",
|
||||||
"/main.css",
|
"/main.css",
|
||||||
"/serviceworker.js"
|
"/serviceworker.js"
|
||||||
@ -26,19 +27,9 @@ self.addEventListener('activate', (event) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
self.addEventListener('message', (event) => {
|
self.addEventListener('message', (event) => {
|
||||||
if (event.data === "clear_cache") {
|
|
||||||
log("Clearing cache");
|
log("Clearing cache");
|
||||||
caches.delete(CACHE);
|
caches.delete(CACHE);
|
||||||
}
|
event.waitUntil(precache());
|
||||||
|
|
||||||
if (event.data === "update_index") {
|
|
||||||
log("Updating index");
|
|
||||||
event.waitUntil(caches.open(CACHE).then((cache) => {
|
|
||||||
return cache.addAll(["/", "/index.html"]).then(() => {
|
|
||||||
event.ports[0].postMessage("reload");
|
|
||||||
});
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var Types;
|
var Types;
|
||||||
@ -46,6 +37,7 @@ var Types;
|
|||||||
Types[Types["CACHE"] = 0] = "CACHE";
|
Types[Types["CACHE"] = 0] = "CACHE";
|
||||||
Types[Types["NOCACHE"] = 1] = "NOCACHE";
|
Types[Types["NOCACHE"] = 1] = "NOCACHE";
|
||||||
Types[Types["REFRESH"] = 2] = "REFRESH";
|
Types[Types["REFRESH"] = 2] = "REFRESH";
|
||||||
|
Types[Types["INDEX"] = 3] = "INDEX";
|
||||||
})(Types || (Types = {}));
|
})(Types || (Types = {}));
|
||||||
|
|
||||||
let rules = [{
|
let rules = [{
|
||||||
@ -53,6 +45,11 @@ let rules = [{
|
|||||||
return url.indexOf("/api/") >= 0;
|
return url.indexOf("/api/") >= 0;
|
||||||
},
|
},
|
||||||
type: Types.NOCACHE
|
type: Types.NOCACHE
|
||||||
|
}, {
|
||||||
|
match: (url) => {
|
||||||
|
return url.indexOf("/share") >= 0;
|
||||||
|
},
|
||||||
|
type: Types.INDEX
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: () => {
|
match: () => {
|
||||||
@ -77,6 +74,11 @@ self.addEventListener('fetch', (evt) => {
|
|||||||
});
|
});
|
||||||
case Types.NOCACHE:
|
case Types.NOCACHE:
|
||||||
return fetch(evt.request);
|
return fetch(evt.request);
|
||||||
|
case Types.INDEX:
|
||||||
|
return refresh(new Request("/")).then(r => {
|
||||||
|
evt.waitUntil(r.refresh.catch(_ => {}));
|
||||||
|
return r.result;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
});
|
});
|
||||||
|
@ -3,8 +3,8 @@ import "./add_button.scss";
|
|||||||
import Plus from "feather-icons/dist/icons/plus.svg";
|
import Plus from "feather-icons/dist/icons/plus.svg";
|
||||||
export default function AddButton({ onClick }: { onClick: () => void }) {
|
export default function AddButton({ onClick }: { onClick: () => void }) {
|
||||||
return <button
|
return <button
|
||||||
title={"add button"}
|
title="add button"
|
||||||
class="add-button-button uk-button-primary uk-border-circle def-shadow"
|
class="fab btn-primary"
|
||||||
onClick={() => onClick()}
|
onClick={() => onClick()}
|
||||||
>
|
>
|
||||||
<Plus width={undefined} height={undefined} />
|
<Plus width={undefined} height={undefined} />
|
||||||
|
@ -40,7 +40,7 @@ export class Footer extends Component<{}, { synced: boolean, syncing: boolean }>
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let extrac = "";
|
let extrac = undefined;
|
||||||
let color;
|
let color;
|
||||||
let text;
|
let text;
|
||||||
if (this.state.syncing) {
|
if (this.state.syncing) {
|
||||||
@ -56,15 +56,17 @@ export class Footer extends Component<{}, { synced: boolean, syncing: boolean }>
|
|||||||
text = "not synced";
|
text = "not synced";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return <footer class="uk-background-default def-shadow">
|
return <footer class="elv-8" style="line-height: 1.1rem;">
|
||||||
<span>
|
<span>
|
||||||
<span class={extrac} ><a onClick={() => this.onSyncClick()} ><Refresh style="height: 1em; width: 1em;"></Refresh></a></span>
|
<span><a class={extrac} onClick={() => this.onSyncClick()} ><Refresh style="height: 1.1em; width: 1.1em;"></Refresh></a></span>
|
||||||
<span style={"margin-left: 8px; color:" + color}>{text}</span>
|
<span style={"margin-left: 8px; color:" + color}>{text}</span>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
Welcome <b>{Notes.name}</b>
|
Welcome <b>{Notes.name}</b>
|
||||||
</span>
|
</span>
|
||||||
|
<span style="color: lightgrey;">
|
||||||
|
v1.4
|
||||||
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ export class Router extends Component<{}, { next?: JSX.Element, current: JSX.Ele
|
|||||||
render() {
|
render() {
|
||||||
let overlay;
|
let overlay;
|
||||||
if (this.state.next) {
|
if (this.state.next) {
|
||||||
overlay = <div class="transition_container transition_slidein uk-background-default" key={this.state.next.key} ref={(elm: HTMLDivElement) => {
|
overlay = <div class="transition_container transition_slidein background-default" key={this.state.next.key} ref={(elm: HTMLDivElement) => {
|
||||||
let lst = () => {
|
let lst = () => {
|
||||||
if (this.state.next)
|
if (this.state.next)
|
||||||
this.setState({ current: this.state.next, next: undefined }, () => {
|
this.setState({ current: this.state.next, next: undefined }, () => {
|
||||||
@ -42,8 +42,8 @@ export class Router extends Component<{}, { next?: JSX.Element, current: JSX.Ele
|
|||||||
{this.state.next}
|
{this.state.next}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
return <div style="position: relative; overflow-x: hidden; width: 100vw; height: 100vh;">
|
return <div style="position: relative; overflow-x: hidden; width: 100vw; height: calc(100vh - 2rem);">
|
||||||
<div class="transition_container uk-background-default" key={this.state.current.key} ref={elm => this.mounted = elm}>
|
<div class="transition_container background-default" key={this.state.current.key} ref={elm => this.mounted = elm}>
|
||||||
{this.state.current}
|
{this.state.current}
|
||||||
</div>
|
</div>
|
||||||
{overlay}
|
{overlay}
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
>button {
|
>button {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: block;
|
display: block;
|
||||||
|
background-color: rgb(224, 224, 224);
|
||||||
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
>*:not(:last-child) {
|
>*:not(:last-child) {
|
||||||
|
@ -1,14 +1,22 @@
|
|||||||
@import "../vars.scss";
|
@import "../vars.scss";
|
||||||
|
|
||||||
.reloading { animation: turner 1s infinite linear }
|
.reloading {
|
||||||
|
display: inline-block;
|
||||||
|
animation: turner 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes turner {
|
@keyframes turner {
|
||||||
from{ transform: rotate(0deg) }
|
from {
|
||||||
to { transform: rotate(360deg) }
|
transform: rotate(0deg)
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
z-index: 128;
|
// z-index: 128;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -19,5 +27,5 @@ footer {
|
|||||||
|
|
||||||
// border-top: 1px solid $border-color;
|
// border-top: 1px solid $border-color;
|
||||||
|
|
||||||
padding: 0.15em !important;
|
padding: 0.15em 1em !important;
|
||||||
}
|
}
|
@ -27,12 +27,10 @@ export class InputModal extends Modal<string> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Modal.BaseModal modal={this.props.modal}>
|
return <Modal.BaseModal modal={this.props.modal}>
|
||||||
<div class="uk-form-horizontal uk-margin-large">
|
<div>
|
||||||
<div class="uk-margin">
|
<div class="input-group">
|
||||||
<label class="uk-form-label" for={this.rand}>{this.props.modal.fieldname}</label>
|
<label for={this.rand}>{this.props.modal.fieldname}</label>
|
||||||
<div class="uk-form-controls">
|
|
||||||
<input
|
<input
|
||||||
class="uk-input"
|
|
||||||
id={this.rand}
|
id={this.rand}
|
||||||
type={this.props.modal.type}
|
type={this.props.modal.type}
|
||||||
placeholder={this.props.modal.fieldname}
|
placeholder={this.props.modal.fieldname}
|
||||||
@ -45,9 +43,8 @@ export class InputModal extends Modal<string> {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="modal-action">
|
||||||
<div class="uk-margin" style="text-align: right;">
|
<button class="btn btn-primary" onClick={() => {
|
||||||
<button class="uk-button uk-button-primary" style="display: inline-block;" onClick={() => {
|
|
||||||
this.props.modal.result(this.input.value);
|
this.props.modal.result(this.input.value);
|
||||||
}}>Enter</button>
|
}}>Enter</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,7 +12,7 @@ export default class LoadingModal extends Modal<undefined> {
|
|||||||
getComponent() {
|
getComponent() {
|
||||||
return <Modal.BaseModal modal={this}>
|
return <Modal.BaseModal modal={this}>
|
||||||
<div style="display: flex; justify-content: center;">
|
<div style="display: flex; justify-content: center;">
|
||||||
<div style="margin: 3rem;" class="uk-spinner uk-icon">
|
<div style="margin: 3rem;" class="">
|
||||||
<svg width="90" height="90" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg" data-svg="spinner"><circle fill="none" stroke="#000" cx="15" cy="15" r="14" style="stroke-width: 0.333333px;"></circle></svg>
|
<svg width="90" height="90" viewBox="0 0 30 30" xmlns="http://www.w3.org/2000/svg" data-svg="spinner"><circle fill="none" stroke="#000" cx="15" cy="15" r="14" style="stroke-width: 0.333333px;"></circle></svg>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,8 +65,8 @@ export default abstract class Modal<T> {
|
|||||||
this.props.modal.result(null)
|
this.props.modal.result(null)
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<div id="ModalContent" class="uk-card uk-card-body uk-card-body" >
|
<div id="ModalContent" class="modal" >
|
||||||
<div class="modal-title uk-card-title" style="">
|
<div class="modal-title" style="">
|
||||||
<h3>{this.props.modal.title}</h3>
|
<h3>{this.props.modal.title}</h3>
|
||||||
{/* <div> */}
|
{/* <div> */}
|
||||||
{!this.props.modal.noClose ?
|
{!this.props.modal.noClose ?
|
||||||
|
@ -28,16 +28,14 @@ export class YesNoModal extends Modal<boolean> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <Modal.BaseModal modal={this.props.modal}>
|
return <Modal.BaseModal modal={this.props.modal}>
|
||||||
<div class="uk-margin-large">
|
<div class="modal-action">
|
||||||
<div style="text-align: right;">
|
<button class="btn-primary" onClick={() => {
|
||||||
<button class="uk-button uk-button-primary uk-margin-right" style="display: inline-block;" onClick={() => {
|
|
||||||
this.props.modal.result(false);
|
this.props.modal.result(false);
|
||||||
}}><span style="text-decoration: underline;">N</span>o</button>
|
}}><span style="text-decoration: underline;">N</span>o</button>
|
||||||
<button class="uk-button uk-button-primary" style="display: inline-block;" onClick={() => {
|
<button class="btn-primary" onClick={() => {
|
||||||
this.props.modal.result(true);
|
this.props.modal.result(true);
|
||||||
}}><span style="text-decoration: underline;">Y</span>es</button>
|
}}><span style="text-decoration: underline;">Y</span>es</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</Modal.BaseModal>
|
</Modal.BaseModal>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,24 +4,25 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgba(0, 0, 0, 0.8);
|
|
||||||
z-index: 32;
|
z-index: 32;
|
||||||
|
animation: darkenBackground .2s linear;
|
||||||
|
background: rgba(0, 0, 0, 0.8)
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-container>.uk-card {
|
@keyframes darkenBackground {
|
||||||
position: absolute;
|
from {
|
||||||
left: 0;
|
background: rgba(0, 0, 0, 0);
|
||||||
right: 0;
|
}
|
||||||
top: 10%;
|
|
||||||
width: 80%;
|
to {
|
||||||
max-width: 800px;
|
background: rgba(0, 0, 0, 0.8);
|
||||||
margin: auto;
|
}
|
||||||
background: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-title {
|
.modal-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
>svg {
|
>svg {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
@ -56,5 +57,5 @@
|
|||||||
margin-right:var(--notification-margin);
|
margin-right:var(--notification-margin);
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
// transition: all .3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { h, Component } from "preact";
|
import { h, Component } from "preact";
|
||||||
import Notes from "../notes";
|
|
||||||
|
|
||||||
import "./notifications.scss"
|
import "./notifications.scss"
|
||||||
import Notifications, { MessageType } from "../notifications";
|
import Notifications, { MessageType } from "../notifications";
|
||||||
@ -37,11 +36,11 @@ export default class NotificationsComponent extends Component<{}, {
|
|||||||
this.setState({ notifications: n });
|
this.setState({ notifications: n });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.removeNot(not);
|
this.removeNot(not);
|
||||||
}, 3000);
|
}, 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeNot(not: { message: string }) {
|
removeNot(not: { message: string }) {
|
||||||
let n = this.state.notifications.slice(0).filter(e => e !== not);
|
let n = this.state.notifications.filter(e => e !== not);
|
||||||
this.setState({ notifications: n });
|
this.setState({ notifications: n });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
src/components/routes/404/index.tsx
Normal file
5
src/components/routes/404/index.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { h } from "preact";
|
||||||
|
|
||||||
|
export default function Error404Page() {
|
||||||
|
return <h1>Page not found!</h1>;
|
||||||
|
}
|
37
src/components/routes/settings/Settings.tsx
Normal file
37
src/components/routes/settings/Settings.tsx
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { h } from "preact";
|
||||||
|
import { Page } from "../../../page";
|
||||||
|
import Theme, { ThemeStates } from "../../../theme";
|
||||||
|
import Navigation from "../../../navigation";
|
||||||
|
import ArrowLeft from "feather-icons/dist/icons/arrow-left.svg";
|
||||||
|
|
||||||
|
export default class SettingsPage extends Page<{ state: any }, { vault: string }> {
|
||||||
|
componentWillMount() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
let active = Theme.active();
|
||||||
|
return <div>
|
||||||
|
<header class="header">
|
||||||
|
<a class="header-icon-button" onClick={() => history.back()}><ArrowLeft height={undefined} width={undefined} /></a>
|
||||||
|
<h3 style="display:inline" class="header-title" onClick={() => Navigation.setPage("/")}>Settings</h3>
|
||||||
|
<span></span>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<div className="input-group">
|
||||||
|
<label>Select Theme: </label>
|
||||||
|
<select class="inp" onChange={(ev) => Theme.change(Number((ev.target as HTMLSelectElement).value))}>
|
||||||
|
{Object.keys(ThemeStates)
|
||||||
|
.filter(e => Number.isNaN(Number(e)))
|
||||||
|
.map(e => <option selected={ThemeStates[e] === active} value={ThemeStates[e]}>{e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()}</option>)}
|
||||||
|
{/* <option value={ThemeStates.AUTO}>Auto</option>
|
||||||
|
<option value={ThemeStates.LIGHT}>Light</option>
|
||||||
|
<option value={ThemeStates.DARK}>Dark</option> */}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{/* <button class="btn" onClick={() => Theme.toggle()}>Toggle Dark Mode</button> */}
|
||||||
|
<button class="btn" onClick={() => window.navigator.serviceWorker.controller.postMessage("message")}>Clear cache</button>
|
||||||
|
</div>
|
||||||
|
</div >;
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ import Navigation from "../../../navigation";
|
|||||||
export default class SharePage extends Page<{ state: any }, { vault: string }> {
|
export default class SharePage extends Page<{ state: any }, { vault: string }> {
|
||||||
text: string;
|
text: string;
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
let { title, text, url } = Navigation.getQuery() || {} as any;
|
let { title, text, url } = this.props.state;
|
||||||
let note = "";
|
let note = "";
|
||||||
if (title) {
|
if (title) {
|
||||||
note += title + "\n"
|
note += title + "\n"
|
||||||
@ -24,7 +24,9 @@ export default class SharePage extends Page<{ state: any }, { vault: string }> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <VaultsPage state={undefined} selectVault onSelected={vault => {
|
return <VaultsPage state={undefined} selectVault onSelected={vault => {
|
||||||
Navigation.setPage("/vault", { id: vault }, { entry: "true", note: this.text }, true);
|
Navigation.setPage("/", undefined, undefined, true);
|
||||||
|
Navigation.setPage("/vault", { id: vault });
|
||||||
|
Navigation.setPage("/vault", { id: vault }, { entry: "true", note: this.text });
|
||||||
}} />
|
}} />
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
51
src/components/routes/vault/Editor.tsx
Normal file
51
src/components/routes/vault/Editor.tsx
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import { Component, h } from "preact";
|
||||||
|
import * as EasyMDE from "easymde";
|
||||||
|
// import "./easymde.css";
|
||||||
|
// import "./dark.css";
|
||||||
|
import "easymde/dist/easymde.min.css";
|
||||||
|
// import "codemirror/theme/monokai.css";
|
||||||
|
|
||||||
|
export interface EditorProps {
|
||||||
|
value: string;
|
||||||
|
valueChange: (value: string) => void;
|
||||||
|
save: () => void;
|
||||||
|
exit: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class Editor extends Component<EditorProps, {}> {
|
||||||
|
element: HTMLInputElement;
|
||||||
|
easymde: EasyMDE;
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
if (this.easymde)
|
||||||
|
this.easymde.toTextArea();
|
||||||
|
|
||||||
|
this.easymde = new EasyMDE({
|
||||||
|
element: this.element,
|
||||||
|
initialValue: this.props.value,
|
||||||
|
autofocus: true,
|
||||||
|
spellChecker: false
|
||||||
|
// theme: "monokai"
|
||||||
|
// autoDownloadFontAwesome: true
|
||||||
|
})
|
||||||
|
|
||||||
|
this.easymde.codemirror.on("change", () => {
|
||||||
|
this.props.valueChange(this.easymde.value());
|
||||||
|
});
|
||||||
|
|
||||||
|
this.easymde.codemirror.addKeyMap({
|
||||||
|
"Ctrl-S": () => this.props.save(),
|
||||||
|
"Esc": () => this.props.exit()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldComponentUpdate(props: EditorProps) {
|
||||||
|
if (this.easymde.value() !== props.value)
|
||||||
|
this.easymde.value(props.value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return <textarea ref={ta => this.element = ta}></textarea>
|
||||||
|
}
|
||||||
|
}
|
188
src/components/routes/vault/Entry.1.tsx.old
Executable file
188
src/components/routes/vault/Entry.1.tsx.old
Executable file
@ -0,0 +1,188 @@
|
|||||||
|
import { h, Component } from "preact"
|
||||||
|
import { IVault, ViewNote } from "../../../notes";
|
||||||
|
import Trash from "feather-icons/dist/icons/trash-2.svg"
|
||||||
|
import X from "feather-icons/dist/icons/x.svg"
|
||||||
|
import Save from "feather-icons/dist/icons/save.svg"
|
||||||
|
|
||||||
|
import Navigation from "../../../navigation";
|
||||||
|
import { YesNoModal } from "../../modals/YesNoModal";
|
||||||
|
import Notifications, { MessageType } from "../../../notifications";
|
||||||
|
|
||||||
|
const minRows = 3;
|
||||||
|
export default class EntryComponent extends Component<{ vault: Promise<IVault>, id: string | undefined, note: string | undefined }, { title: string, changed: boolean }> {
|
||||||
|
private text: string = "";
|
||||||
|
private vault: IVault;
|
||||||
|
// private lineHeight: number = 24;
|
||||||
|
private note: ViewNote;
|
||||||
|
|
||||||
|
private rows: number = minRows;
|
||||||
|
|
||||||
|
private skip_save: boolean = false;
|
||||||
|
|
||||||
|
private inputElm: HTMLInputElement;
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = { changed: false, title: "" };
|
||||||
|
this.textAreaChange = this.textAreaChange.bind(this);
|
||||||
|
this.textAreaKeyPress = this.textAreaKeyPress.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private toVault() {
|
||||||
|
history.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.inputElm.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
async componentWillMount() {
|
||||||
|
this.text = "";
|
||||||
|
this.vault = undefined;
|
||||||
|
this.note = undefined;
|
||||||
|
this.rows = minRows;
|
||||||
|
this.skip_save = false;
|
||||||
|
this.setState({ changed: false, title: "" });
|
||||||
|
try {
|
||||||
|
this.skip_save = false;
|
||||||
|
|
||||||
|
this.vault = await this.props.vault;
|
||||||
|
let note: ViewNote;
|
||||||
|
let changed = false;
|
||||||
|
if (this.props.id)
|
||||||
|
note = await this.vault.getNote(this.props.id)
|
||||||
|
else {
|
||||||
|
note = this.vault.newNote();
|
||||||
|
if (this.props.note) {
|
||||||
|
note.__value = this.props.note;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!note) {
|
||||||
|
Notifications.sendNotification("Note not found!", MessageType.ERROR);
|
||||||
|
} else {
|
||||||
|
this.note = note;
|
||||||
|
this.text = note.__value;
|
||||||
|
let rows = this.getRows(this.text);
|
||||||
|
if (rows !== this.rows) {
|
||||||
|
this.rows = rows;
|
||||||
|
}
|
||||||
|
let [title] = this.text.split("\n", 1);
|
||||||
|
this.setState({ title, changed })
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
Notifications.sendError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async save() {
|
||||||
|
try {
|
||||||
|
if (this.state.changed) {
|
||||||
|
this.note.__value = this.text;
|
||||||
|
await this.vault.saveNote(this.note);
|
||||||
|
this.setState({ changed: false })
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
Notifications.sendError(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (!this.skip_save)
|
||||||
|
this.save()
|
||||||
|
}
|
||||||
|
|
||||||
|
strToNr(value: string) {
|
||||||
|
let match = value.match(/\d/g)
|
||||||
|
return Number(match.join(""))
|
||||||
|
}
|
||||||
|
|
||||||
|
getRows(value: string) {
|
||||||
|
const lines = (value.match(/\r?\n/g) || '').length + 1
|
||||||
|
return Math.max(lines + 1, minRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
textAreaChange(evt: KeyboardEvent) {
|
||||||
|
if (evt.keyCode === 17 || evt.keyCode === 27) return; //No character, so not relevant for this function
|
||||||
|
if (!this.state.changed && this.textAreaKeyPress(evt)) this.setState({ changed: true })
|
||||||
|
|
||||||
|
let target = (evt.target as HTMLTextAreaElement)
|
||||||
|
let value = target.value;
|
||||||
|
|
||||||
|
this.text = value;
|
||||||
|
|
||||||
|
let [title] = value.split("\n", 1);
|
||||||
|
if (title !== this.state.title)
|
||||||
|
this.setState({ title });
|
||||||
|
|
||||||
|
let rows = this.getRows(value);
|
||||||
|
if (rows !== this.rows) {
|
||||||
|
target.rows = rows;
|
||||||
|
this.rows = rows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async exitHandler() {
|
||||||
|
if (this.state.changed) {
|
||||||
|
let modal = new YesNoModal("Really want to quit?");
|
||||||
|
let res = await modal.getResult();
|
||||||
|
if (res === true) {
|
||||||
|
this.skip_save = true;
|
||||||
|
this.toVault();
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
this.toVault()
|
||||||
|
}
|
||||||
|
|
||||||
|
textAreaKeyPress(evt: KeyboardEvent) {
|
||||||
|
console.log(evt);
|
||||||
|
if ((evt.keyCode === 83 || evt.keyCode === 13) && evt.ctrlKey) {
|
||||||
|
evt.preventDefault()
|
||||||
|
this.save();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (evt.keyCode === 27) {
|
||||||
|
evt.preventDefault();
|
||||||
|
this.exitHandler();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const save_handler = async () => {
|
||||||
|
await this.save()
|
||||||
|
Navigation.setPage("/vault", { id: this.vault.id }, { entry: "false" }, true);
|
||||||
|
this.toVault()
|
||||||
|
}
|
||||||
|
|
||||||
|
const delete_handler = async () => {
|
||||||
|
await this.vault.deleteNote(this.props.id);
|
||||||
|
this.toVault()
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Rerender")
|
||||||
|
|
||||||
|
return <div>
|
||||||
|
<header class="header">
|
||||||
|
<a class="header-icon-button" onClick={() => this.exitHandler()}><X height={undefined} width={undefined} /></a>
|
||||||
|
{this.state.changed ? <a class="header-icon-button" style="margin-left: 0.5em;" onClick={() => save_handler()}><Save height={undefined} width={undefined} /></a> : undefined}
|
||||||
|
<h3 style="display:inline" class="button header-title">{this.state.title}</h3>
|
||||||
|
<a class="header-icon-button" onClick={() => delete_handler()}><Trash height={undefined} width={undefined} /></a>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<textarea
|
||||||
|
value={this.text}
|
||||||
|
rows={this.rows}
|
||||||
|
class="inp"
|
||||||
|
style="width:100%;"
|
||||||
|
onInput={this.textAreaChange}
|
||||||
|
onKeyDown={this.textAreaKeyPress}
|
||||||
|
onChange={this.textAreaChange}
|
||||||
|
ref={elm => this.inputElm = elm}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,15 @@
|
|||||||
import { h, Component } from "preact"
|
import { h, Component } from "preact"
|
||||||
import Notes, { IVault, ViewNote } from "../../../notes";
|
import { IVault, ViewNote } from "../../../notes";
|
||||||
import Trash from "feather-icons/dist/icons/trash-2.svg"
|
import Trash from "feather-icons/dist/icons/trash-2.svg"
|
||||||
import X from "feather-icons/dist/icons/x.svg"
|
import X from "feather-icons/dist/icons/x.svg"
|
||||||
import Save from "feather-icons/dist/icons/save.svg"
|
import Save from "feather-icons/dist/icons/save.svg"
|
||||||
|
|
||||||
import Navigation from "../../../navigation";
|
import Navigation from "../../../navigation";
|
||||||
import { YesNoModal } from "../../modals/YesNoModal";
|
import { YesNoModal } from "../../modals/YesNoModal";
|
||||||
import LoadingModal from "../../modals/LoadingModal";
|
|
||||||
import Notifications, { MessageType } from "../../../notifications";
|
import Notifications, { MessageType } from "../../../notifications";
|
||||||
import Modal from "../../modals/Modal";
|
import Theme from "../../../theme";
|
||||||
|
|
||||||
|
import Editor from "./Editor";
|
||||||
|
|
||||||
const minRows = 3;
|
const minRows = 3;
|
||||||
export default class EntryComponent extends Component<{ vault: Promise<IVault>, id: string | undefined, note: string | undefined }, { title: string, changed: boolean }> {
|
export default class EntryComponent extends Component<{ vault: Promise<IVault>, id: string | undefined, note: string | undefined }, { title: string, changed: boolean }> {
|
||||||
@ -17,10 +18,9 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
|
|||||||
// private lineHeight: number = 24;
|
// private lineHeight: number = 24;
|
||||||
private note: ViewNote;
|
private note: ViewNote;
|
||||||
|
|
||||||
private rows: number = minRows;
|
|
||||||
|
|
||||||
private skip_save: boolean = false;
|
private skip_save: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { changed: false, title: "" };
|
this.state = { changed: false, title: "" };
|
||||||
@ -30,18 +30,15 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
|
|||||||
history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() { }
|
||||||
|
|
||||||
async componentWillMount() {
|
async componentWillMount() {
|
||||||
this.text = "";
|
this.text = "";
|
||||||
this.vault = undefined;
|
this.vault = undefined;
|
||||||
this.note = undefined;
|
this.note = undefined;
|
||||||
this.rows = minRows;
|
|
||||||
this.skip_save = false;
|
this.skip_save = false;
|
||||||
this.setState({ changed: false, title: "" });
|
this.setState({ changed: false, title: "" });
|
||||||
try {
|
try {
|
||||||
this.skip_save = false;
|
|
||||||
// this.loading = new LoadingModal();
|
|
||||||
// this.loading.show();
|
|
||||||
|
|
||||||
this.vault = await this.props.vault;
|
this.vault = await this.props.vault;
|
||||||
let note: ViewNote;
|
let note: ViewNote;
|
||||||
let changed = false;
|
let changed = false;
|
||||||
@ -57,22 +54,12 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
|
|||||||
|
|
||||||
if (!note) {
|
if (!note) {
|
||||||
Notifications.sendNotification("Note not found!", MessageType.ERROR);
|
Notifications.sendNotification("Note not found!", MessageType.ERROR);
|
||||||
// this.toVault()
|
|
||||||
} else {
|
} else {
|
||||||
this.note = note;
|
this.note = note;
|
||||||
this.text = note.__value;
|
this.text = note.__value;
|
||||||
let rows = this.getRows(this.text);
|
|
||||||
if (rows !== this.rows) {
|
|
||||||
this.rows = rows;
|
|
||||||
}
|
|
||||||
// async onKeypress(event) {
|
|
||||||
// event = event || window.event;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
let [title] = this.text.split("\n", 1);
|
let [title] = this.text.split("\n", 1);
|
||||||
this.setState({ title, changed })
|
this.setState({ title, changed })
|
||||||
// if (this.loading)
|
|
||||||
// this.loading.close();
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Notifications.sendError(err);
|
Notifications.sendError(err);
|
||||||
@ -96,36 +83,18 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
|
|||||||
this.save()
|
this.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
strToNr(value: string) {
|
private textChange(value: string) {
|
||||||
let match = value.match(/\d/g)
|
if (!this.state.changed && value !== this.text)
|
||||||
return Number(match.join(""))
|
this.setState({ changed: true })
|
||||||
}
|
|
||||||
|
|
||||||
getRows(value: string) {
|
|
||||||
const lines = (value.match(/\r?\n/g) || '').length + 1
|
|
||||||
return Math.max(lines + 1, minRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
textAreaChange(evt: KeyboardEvent) {
|
|
||||||
if (evt.keyCode === 17 || evt.keyCode === 27) return; //No character, so not relevant for this function
|
|
||||||
let target = (evt.target as HTMLTextAreaElement)
|
|
||||||
let value = target.value;
|
|
||||||
|
|
||||||
this.text = value;
|
this.text = value;
|
||||||
if (!this.state.changed && this.textAreaKeyPress(evt)) this.setState({ changed: true })
|
|
||||||
|
|
||||||
let [title] = value.split("\n", 1);
|
let [title] = value.split("\n", 1);
|
||||||
if (title !== this.state.title)
|
if (title !== this.state.title)
|
||||||
this.setState({ title });
|
this.setState({ title });
|
||||||
|
|
||||||
let rows = this.getRows(value);
|
|
||||||
if (rows !== this.rows) {
|
|
||||||
target.rows = rows;
|
|
||||||
this.rows = rows;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async exitHandler() {
|
private async exitHandler() {
|
||||||
if (this.state.changed) {
|
if (this.state.changed) {
|
||||||
let modal = new YesNoModal("Really want to quit?");
|
let modal = new YesNoModal("Really want to quit?");
|
||||||
let res = await modal.getResult();
|
let res = await modal.getResult();
|
||||||
@ -137,20 +106,6 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
|
|||||||
this.toVault()
|
this.toVault()
|
||||||
}
|
}
|
||||||
|
|
||||||
textAreaKeyPress(evt: KeyboardEvent) {
|
|
||||||
if ((evt.keyCode === 83 || evt.keyCode === 13) && evt.ctrlKey) {
|
|
||||||
evt.preventDefault()
|
|
||||||
this.save();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (evt.keyCode === 27) {
|
|
||||||
evt.preventDefault();
|
|
||||||
this.exitHandler();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const save_handler = async () => {
|
const save_handler = async () => {
|
||||||
await this.save()
|
await this.save()
|
||||||
@ -161,40 +116,23 @@ export default class EntryComponent extends Component<{ vault: Promise<IVault>,
|
|||||||
const delete_handler = async () => {
|
const delete_handler = async () => {
|
||||||
await this.vault.deleteNote(this.props.id);
|
await this.vault.deleteNote(this.props.id);
|
||||||
this.toVault()
|
this.toVault()
|
||||||
// async onKeypress(event) {
|
|
||||||
// event = event || window.event;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Rerender")
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
<header class="uk-background-primary">
|
<header class="header">
|
||||||
{/* <div> */}
|
|
||||||
<a class="header-icon-button" onClick={() => this.exitHandler()}><X height={undefined} width={undefined} /></a>
|
<a class="header-icon-button" onClick={() => this.exitHandler()}><X height={undefined} width={undefined} /></a>
|
||||||
{this.state.changed ? <a class="header-icon-button" style="margin-left: 0.5em;" onClick={() => save_handler()}><Save height={undefined} width={undefined} /></a> : undefined}
|
{this.state.changed ? <a class="header-icon-button" style="margin-left: 0.5em;" onClick={() => save_handler()}><Save height={undefined} width={undefined} /></a> : undefined}
|
||||||
{/* </div> */}
|
|
||||||
<h3 style="display:inline" class="button header-title">{this.state.title}</h3>
|
<h3 style="display:inline" class="button header-title">{this.state.title}</h3>
|
||||||
<a class="header-icon-button" onClick={() => delete_handler()}><Trash height={undefined} width={undefined} /></a>
|
<a class="header-icon-button" onClick={() => delete_handler()}><Trash height={undefined} width={undefined} /></a>
|
||||||
</header>
|
</header>
|
||||||
<div class="uk-container">
|
<div class="container" style={Theme.isDark() ? "filter: invert(100%);" : ""}>
|
||||||
<textarea
|
<Editor
|
||||||
// async onKeypress(event) {
|
|
||||||
// event = event || window.event;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
autofocus
|
|
||||||
value={this.text}
|
value={this.text}
|
||||||
rows={this.rows}
|
valueChange={value => this.textChange(value)}
|
||||||
class="doc uk-textarea"
|
save={() => this.save()}
|
||||||
style="width:100%;"
|
exit={() => this.exitHandler()} />
|
||||||
onInput={evt => this.textAreaChange(evt as KeyboardEvent)}
|
|
||||||
onKeyDown={evt => this.textAreaKeyPress(evt)}
|
|
||||||
onChange={evt => this.textAreaChange(evt as KeyboardEvent)}
|
|
||||||
ref={elm => {
|
|
||||||
if (elm)
|
|
||||||
setTimeout(() => elm.focus(), 500)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,15 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
|
|||||||
|
|
||||||
onContext(evt: MouseEvent, note: BaseNote) {
|
onContext(evt: MouseEvent, note: BaseNote) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
evt.stopPropagation();
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
document.documentElement.removeEventListener("click", close);
|
||||||
|
this.setState({ context: undefined });
|
||||||
|
}
|
||||||
|
document.documentElement.addEventListener("click", close);
|
||||||
|
|
||||||
|
|
||||||
const shareNote = async () => {
|
const shareNote = async () => {
|
||||||
let nav = window.navigator as any;
|
let nav = window.navigator as any;
|
||||||
if (nav.share !== undefined) {
|
if (nav.share !== undefined) {
|
||||||
@ -72,20 +81,44 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
|
|||||||
} else {
|
} else {
|
||||||
Notifications.sendError("Sharing not possible on this device")
|
Notifications.sendError("Sharing not possible on this device")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteNote = async () => {
|
||||||
|
this.vault.deleteNote(note._id).then(() => {
|
||||||
|
Notifications.sendSuccess("Deleted")
|
||||||
|
this.rawNotes = this.rawNotes.filter(e => e._id !== note._id);
|
||||||
|
this.setState({ notes: this.state.notes.filter(e => e._id !== note._id) });
|
||||||
|
}).catch(err => {
|
||||||
|
Notifications.sendError(err);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const copyNote = async () => {
|
||||||
|
this.vault.getNote(note._id).then(note => {
|
||||||
|
const el = document.createElement('textarea');
|
||||||
|
el.value = note.__value;
|
||||||
|
document.body.appendChild(el);
|
||||||
|
el.select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(el);
|
||||||
|
Notifications.sendSuccess("Copied");
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let share;
|
let share;
|
||||||
if ((window.navigator as any).share) {
|
if ((window.navigator as any).share) {
|
||||||
share = <button class="uk-button" onClick={() => shareNote()}>
|
share = <button class="btn" onClick={shareNote}>
|
||||||
share
|
share
|
||||||
</button>
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
let context = <ContextMenu event={evt} >
|
let context = <ContextMenu event={evt} >
|
||||||
{share}
|
{share}
|
||||||
|
<button class="btn" onClick={deleteNote}>delete</button>
|
||||||
|
<button class="btn" onClick={copyNote}>copy</button>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
|
|
||||||
this.setState({ context });
|
this.setState({ context });
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,32 +265,30 @@ export default class EntryList extends Component<{ vault: Promise<IVault> }, { n
|
|||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
{this.state.context}
|
{this.state.context}
|
||||||
<header class="uk-background-primary">
|
<header class="header">
|
||||||
<a class="header-icon-button" onClick={() => history.back()}><ArrowLeft height={undefined} width={undefined} /></a>
|
<a class="header-icon-button" onClick={() => history.back()}><ArrowLeft height={undefined} width={undefined} /></a>
|
||||||
<h3 style="display:inline" class="header-title" onClick={() => Navigation.setPage("/")}>{this.vault ? this.vault.name : ""}</h3>
|
<h3 style="display:inline" class="header-title" onClick={() => Navigation.setPage("/")}>{this.vault ? this.vault.name : ""}</h3>
|
||||||
<span></span>
|
<span></span>
|
||||||
{/* <a class="button header_icon_button"><MoreVertival height={undefined} width={undefined} /></a> */}
|
{/* <a class="button header_icon_button"><MoreVertival height={undefined} width={undefined} /></a> */}
|
||||||
</header>
|
</header>
|
||||||
<AddButton onClick={() => open_entry(null)} />
|
<AddButton onClick={() => open_entry(null)} />
|
||||||
<div class="uk-container">
|
<div class="container">
|
||||||
<div style="display:flex;">
|
<div style="display:flex;">
|
||||||
<input class="uk-input" type="text" onKeyUp={this.searchChanged} ref={elm => this.searchInput = elm} />
|
<input class="inp" type="text" style="width: 100%; height: 40px;" onKeyUp={this.searchChanged} ref={elm => this.searchInput = elm} />
|
||||||
<button class="uk-button" style="padding: 0 10px;">
|
<button class="btn btn-primary" style="padding: 5px 10px; margin: 0; height: 40px; width: 40px;">
|
||||||
<Search />
|
<Search />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="uk-child-width-1-3@m uk-grid-small uk-grid-match" style="margin-top: 1rem;" uk-grid>
|
<div class="vault-list" style="margin-top: 1rem;">
|
||||||
{this.state.notes.map(note => {
|
{this.state.notes.map(note => {
|
||||||
let [first, second] = note.preview.split("\n", 2);
|
let [first, second] = note.preview.split("\n", 2);
|
||||||
return <div class="" onContextMenu={evt => this.onContext(evt, note)} onClick={() => {
|
return <div class="card vault-vault" onContextMenu={evt => this.onContext(evt, note)} onClick={() => {
|
||||||
open_entry(note._id)
|
open_entry(note._id)
|
||||||
}}>
|
}}>
|
||||||
<div class="uk-card uk-card-default uk-card-body vault-vault" style="box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3)">
|
|
||||||
<div>{first}</div>
|
<div>{first}</div>
|
||||||
<div>{second}</div>
|
<div>{second}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
858
src/components/routes/vault/dark.css
Normal file
858
src/components/routes/vault/dark.css
Normal file
@ -0,0 +1,858 @@
|
|||||||
|
/* SimpleMDE Theme Dark v0.0.0 https://github.com/xcatliu/simplemde-theme-dark#readme */
|
||||||
|
|
||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
|
.CodeMirror-gutter-filler,
|
||||||
|
.CodeMirror-scrollbar-filler {
|
||||||
|
background-color: #fff
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
border-right: 1px solid #ddd;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
white-space: nowrap
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linenumber {
|
||||||
|
padding: 0 3px 0 5px;
|
||||||
|
min-width: 20px;
|
||||||
|
text-align: right;
|
||||||
|
color: #999;
|
||||||
|
white-space: nowrap
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-guttermarker {
|
||||||
|
color: #000
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-guttermarker-subtle {
|
||||||
|
color: #999
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-cursor {
|
||||||
|
border-left: 1px solid #000;
|
||||||
|
border-right: none;
|
||||||
|
width: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror div.CodeMirror-secondarycursor {
|
||||||
|
border-left: 1px solid silver
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-fat-cursor .CodeMirror-cursor {
|
||||||
|
width: auto;
|
||||||
|
border: 0 !important;
|
||||||
|
background: #7e7
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-fat-cursor div.CodeMirror-cursors {
|
||||||
|
z-index: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-animate-fat-cursor {
|
||||||
|
width: auto;
|
||||||
|
border: 0;
|
||||||
|
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||||
|
animation: blink 1.06s steps(1) infinite;
|
||||||
|
background-color: #7e7
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes blink {
|
||||||
|
50% {
|
||||||
|
background-color: transparent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
50% {
|
||||||
|
background-color: transparent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-tab {
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-rulers {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: -50px;
|
||||||
|
bottom: -20px;
|
||||||
|
overflow: hidden
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-ruler {
|
||||||
|
border-left: 1px solid #ccc;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
position: absolute
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror,
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
position: relative;
|
||||||
|
min-height: 300px
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-header {
|
||||||
|
color: #00f
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-quote {
|
||||||
|
color: #090
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-negative {
|
||||||
|
color: #d44
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-positive {
|
||||||
|
color: #292
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-header,
|
||||||
|
.cm-strong {
|
||||||
|
font-weight: 700
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-em {
|
||||||
|
font-style: italic
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-link {
|
||||||
|
text-decoration: underline
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-strikethrough,
|
||||||
|
.cm-strikethrough {
|
||||||
|
text-decoration: line-through
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-keyword {
|
||||||
|
color: #708
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-atom {
|
||||||
|
color: #219
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-number {
|
||||||
|
color: #164
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-def {
|
||||||
|
color: #00f
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-variable-2 {
|
||||||
|
color: #05a
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-variable-3 {
|
||||||
|
color: #085
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-comment {
|
||||||
|
color: #a50
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-string {
|
||||||
|
color: #a11
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-string-2 {
|
||||||
|
color: #f50
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-meta,
|
||||||
|
.cm-s-default .cm-qualifier {
|
||||||
|
color: #555
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-builtin {
|
||||||
|
color: #30a
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-bracket {
|
||||||
|
color: #997
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-tag {
|
||||||
|
color: #170
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-attribute {
|
||||||
|
color: #00c
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-hr {
|
||||||
|
color: #999
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-default .cm-link {
|
||||||
|
color: #00c
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-invalidchar,
|
||||||
|
.cm-s-default .cm-error {
|
||||||
|
color: red
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-composing {
|
||||||
|
border-bottom: 2px solid
|
||||||
|
}
|
||||||
|
|
||||||
|
div.CodeMirror span.CodeMirror-matchingbracket {
|
||||||
|
color: #0f0
|
||||||
|
}
|
||||||
|
|
||||||
|
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
||||||
|
color: #f22
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-matchingtag {
|
||||||
|
background: rgba(255, 150, 0, .3)
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-activeline-background {
|
||||||
|
background: #e8f2ff
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
overflow: scroll !important;
|
||||||
|
height: 100%;
|
||||||
|
outline: 0;
|
||||||
|
position: relative
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-sizer {
|
||||||
|
position: relative;
|
||||||
|
border-right: 30px solid transparent
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter-filler,
|
||||||
|
.CodeMirror-hscrollbar,
|
||||||
|
.CodeMirror-scrollbar-filler,
|
||||||
|
.CodeMirror-vscrollbar {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 6;
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-vscrollbar {
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: scroll
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-hscrollbar {
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: scroll
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scrollbar-filler {
|
||||||
|
right: 0;
|
||||||
|
bottom: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter-filler {
|
||||||
|
left: 0;
|
||||||
|
bottom: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
min-height: 100%;
|
||||||
|
z-index: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter {
|
||||||
|
white-space: normal;
|
||||||
|
height: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin-bottom: -30px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter-wrapper {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 4;
|
||||||
|
background: 0 0 !important;
|
||||||
|
border: none !important;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter-background {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter-elt {
|
||||||
|
position: absolute;
|
||||||
|
cursor: default;
|
||||||
|
z-index: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
cursor: text;
|
||||||
|
min-height: 1px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror pre {
|
||||||
|
border-radius: 0;
|
||||||
|
border-width: 0;
|
||||||
|
background: 0 0;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre;
|
||||||
|
word-wrap: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit;
|
||||||
|
z-index: 2;
|
||||||
|
position: relative;
|
||||||
|
overflow: visible;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
-webkit-font-variant-ligatures: contextual;
|
||||||
|
font-variant-ligatures: contextual
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-wrap pre {
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: normal
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linebackground {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linewidget {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
overflow: auto
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-code {
|
||||||
|
outline: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutter,
|
||||||
|
.CodeMirror-gutters,
|
||||||
|
.CodeMirror-linenumber,
|
||||||
|
.CodeMirror-scroll,
|
||||||
|
.CodeMirror-sizer {
|
||||||
|
box-sizing: content-box
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-measure {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
visibility: hidden
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-cursor {
|
||||||
|
position: absolute;
|
||||||
|
pointer-events: none
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-measure pre {
|
||||||
|
position: static
|
||||||
|
}
|
||||||
|
|
||||||
|
div.CodeMirror-cursors {
|
||||||
|
visibility: hidden;
|
||||||
|
position: relative;
|
||||||
|
z-index: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-focused div.CodeMirror-cursors,
|
||||||
|
div.CodeMirror-dragcursors {
|
||||||
|
visibility: visible
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-selected {
|
||||||
|
background: #d9d9d9
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-focused .CodeMirror-selected {
|
||||||
|
background: #d7d4f0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-crosshair {
|
||||||
|
cursor: crosshair
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-line::selection,
|
||||||
|
.CodeMirror-line>span::selection,
|
||||||
|
.CodeMirror-line>span>span::selection {
|
||||||
|
background: #d7d4f0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-line::-moz-selection,
|
||||||
|
.CodeMirror-line>span::-moz-selection,
|
||||||
|
.CodeMirror-line>span>span::-moz-selection {
|
||||||
|
background: #d7d4f0
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-searching {
|
||||||
|
background: #ffa;
|
||||||
|
background: rgba(255, 255, 0, .4)
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-force-border {
|
||||||
|
padding-right: .1px
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.CodeMirror div.CodeMirror-cursors {
|
||||||
|
visibility: hidden
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-tab-wrap-hack:after {
|
||||||
|
content: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
span.CodeMirror-selectedtext {
|
||||||
|
background: 0 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
background-color: #444;
|
||||||
|
border: 1px solid #555;
|
||||||
|
border-bottom-left-radius: 3px;
|
||||||
|
border-bottom-right-radius: 3px;
|
||||||
|
color: #aaa;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 18px;
|
||||||
|
height: auto;
|
||||||
|
line-height: 1.5;
|
||||||
|
padding: 14px;
|
||||||
|
z-index: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
margin-bottom: -32px;
|
||||||
|
margin-right: -32px;
|
||||||
|
padding-bottom: 32px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-fullscreen {
|
||||||
|
background-color: #444;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid #555;
|
||||||
|
bottom: 0;
|
||||||
|
height: auto;
|
||||||
|
left: 0;
|
||||||
|
position: fixed !important;
|
||||||
|
right: 0;
|
||||||
|
top: 58px;
|
||||||
|
z-index: 9
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-sided {
|
||||||
|
width: 50% !important
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-placeholder {
|
||||||
|
color: #777
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-cursor {
|
||||||
|
border-left-color: #aaa
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror pre,
|
||||||
|
.CodeMirror-lines {
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-focused .CodeMirror-selected,
|
||||||
|
.CodeMirror-line::-moz-selection,
|
||||||
|
.CodeMirror-line>span::-moz-selection,
|
||||||
|
.CodeMirror-line>span>span::-moz-selection,
|
||||||
|
.CodeMirror-selected {
|
||||||
|
background-color: rgba(255, 255, 255, .1)
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-focused .CodeMirror-selected,
|
||||||
|
.CodeMirror-line::selection,
|
||||||
|
.CodeMirror-line>span::selection,
|
||||||
|
.CodeMirror-line>span>span::selection,
|
||||||
|
.CodeMirror-selected {
|
||||||
|
background-color: rgba(255, 255, 255, .1)
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-attribute,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-tag {
|
||||||
|
color: #95bf40
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-string {
|
||||||
|
color: #777
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-link {
|
||||||
|
color: #ffd500
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-formatting-code,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-formatting-code-block,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-formatting-em,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-formatting-header,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-formatting-strikethrough,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-formatting-strong,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-hr,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-quote,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-url {
|
||||||
|
color: #777
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-1,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-2,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-3,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-4,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-5,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-6 {
|
||||||
|
line-height: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-1 {
|
||||||
|
font-size: 32px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-2 {
|
||||||
|
font-size: 26px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-3 {
|
||||||
|
font-size: 24px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-4 {
|
||||||
|
font-size: 22px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-5 {
|
||||||
|
font-size: 20px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header-6 {
|
||||||
|
font-size: 18px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-header,
|
||||||
|
.CodeMirror .CodeMirror-code .cm-strong {
|
||||||
|
font-weight: 600
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code .cm-comment {
|
||||||
|
background-color: rgba(255, 255, 255, .05);
|
||||||
|
font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 6px 0 4px
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror .CodeMirror-code span.CodeMirror-selectedtext.cm-comment {
|
||||||
|
background-color: rgba(255, 255, 255, .05)
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview {
|
||||||
|
height: 100%;
|
||||||
|
left: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview-side {
|
||||||
|
border: 0;
|
||||||
|
border-left: 1px solid #555;
|
||||||
|
border-top: 1px solid #555;
|
||||||
|
bottom: 0;
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
top: 58px;
|
||||||
|
width: 50%;
|
||||||
|
z-index: 9
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview,
|
||||||
|
.editor-preview-side {
|
||||||
|
background-color: #444;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #aaa;
|
||||||
|
display: none;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1.5;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0 14px 14px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview pre,
|
||||||
|
.editor-preview-side pre {
|
||||||
|
background-color: rgba(255, 255, 255, .05);
|
||||||
|
font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.2;
|
||||||
|
margin-top: 14px;
|
||||||
|
overflow: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
padding: 14px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview pre code,
|
||||||
|
.editor-preview-side pre code {
|
||||||
|
background-color: transparent;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview-active,
|
||||||
|
.editor-preview-active-side {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview table,
|
||||||
|
.editor-preview-side table {
|
||||||
|
background-color: #444;
|
||||||
|
border: 0;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview table caption,
|
||||||
|
.editor-preview-side table caption {
|
||||||
|
caption-side: bottom;
|
||||||
|
color: #777;
|
||||||
|
padding: 7px;
|
||||||
|
text-align: left
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview table td,
|
||||||
|
.editor-preview table th,
|
||||||
|
.editor-preview-side table td,
|
||||||
|
.editor-preview-side table th {
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px solid #555;
|
||||||
|
padding: 7px;
|
||||||
|
text-align: left
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview table th,
|
||||||
|
.editor-preview-side table th {
|
||||||
|
background-color: rgba(255, 255, 255, .05);
|
||||||
|
font-weight: 600
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview audio:not([controls]),
|
||||||
|
.editor-preview-side audio:not([controls]) {
|
||||||
|
display: none;
|
||||||
|
height: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview img,
|
||||||
|
.editor-preview-side img {
|
||||||
|
max-width: 100%;
|
||||||
|
vertical-align: middle
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview audio,
|
||||||
|
.editor-preview video,
|
||||||
|
.editor-preview-side audio,
|
||||||
|
.editor-preview-side video {
|
||||||
|
width: 100%
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar {
|
||||||
|
background-color: #444;
|
||||||
|
border: 1px solid #555;
|
||||||
|
border-bottom: 0;
|
||||||
|
border-top-left-radius: 3px;
|
||||||
|
border-top-right-radius: 3px;
|
||||||
|
font-size: 18px;
|
||||||
|
padding: 0 14px;
|
||||||
|
position: relative;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar::after,
|
||||||
|
.editor-toolbar::before {
|
||||||
|
content: ' ';
|
||||||
|
display: block;
|
||||||
|
height: 1px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar::before {
|
||||||
|
margin-bottom: 7px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar::after {
|
||||||
|
margin-top: 7px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a {
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 3px;
|
||||||
|
color: #777 !important;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 80%;
|
||||||
|
height: 30px;
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none !important;
|
||||||
|
width: 30px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.active,
|
||||||
|
.editor-toolbar a:hover {
|
||||||
|
border-color: #555;
|
||||||
|
color: #aaa !important
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a::before {
|
||||||
|
line-height: 30px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.fa-header-x::after {
|
||||||
|
bottom: -.25em;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 80%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.fa-header-1::after {
|
||||||
|
content: "1"
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.fa-header-2::after {
|
||||||
|
content: "2"
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.fa-header-3::after {
|
||||||
|
content: "3"
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.fa-header-bigger::after {
|
||||||
|
content: "▲"
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar a.fa-header-smaller::after {
|
||||||
|
content: "▼"
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar i.separator {
|
||||||
|
border-right: 1px solid #555;
|
||||||
|
color: transparent;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 7px;
|
||||||
|
text-indent: -10px;
|
||||||
|
width: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar:hover a {
|
||||||
|
color: #aaa !important
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen {
|
||||||
|
background-color: #444;
|
||||||
|
border: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: 58px;
|
||||||
|
left: 0;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
padding-bottom: 14px;
|
||||||
|
padding-top: 14px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 9
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen::after,
|
||||||
|
.editor-toolbar.fullscreen::before {
|
||||||
|
height: 58px;
|
||||||
|
left: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
width: 20px
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width:700px) {
|
||||||
|
.editor-toolbar a.no-mobile {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.disabled-for-preview a:not(.no-disable) {
|
||||||
|
background-color: #444;
|
||||||
|
border-color: transparent;
|
||||||
|
pointer-events: none;
|
||||||
|
text-shadow: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar {
|
||||||
|
color: #777;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 80%;
|
||||||
|
padding: 7px 14px;
|
||||||
|
text-align: right
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar span {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 1em
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar .lines::before {
|
||||||
|
content: 'lines: '
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar .words::before {
|
||||||
|
content: 'words: '
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar .characters::before {
|
||||||
|
content: 'characters: '
|
||||||
|
}
|
||||||
|
|
||||||
|
/*# sourceMappingURL=simplemde-theme-dark.min.css.map */
|
321
src/components/routes/vault/easymde.css
Normal file
321
src/components/routes/vault/easymde.css
Normal file
@ -0,0 +1,321 @@
|
|||||||
|
.CodeMirror {
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: auto;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
padding: 10px;
|
||||||
|
font: inherit;
|
||||||
|
z-index: 1;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-fullscreen {
|
||||||
|
background: #fff;
|
||||||
|
position: fixed !important;
|
||||||
|
top: 50px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
height: auto;
|
||||||
|
z-index: 9;
|
||||||
|
border-right: none !important;
|
||||||
|
border-bottom-right-radius: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-sided {
|
||||||
|
width: 50% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-placeholder {
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-focused .CodeMirror-selected {
|
||||||
|
background: #d9d9d9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar {
|
||||||
|
position: relative;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
-o-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
padding: 0 10px;
|
||||||
|
border-top: 1px solid #bbb;
|
||||||
|
border-left: 1px solid #bbb;
|
||||||
|
border-right: 1px solid #bbb;
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar:after,
|
||||||
|
.editor-toolbar:before {
|
||||||
|
display: block;
|
||||||
|
content: ' ';
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar:before {
|
||||||
|
margin-bottom: 8px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar:after {
|
||||||
|
margin-top: 8px
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen {
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: #fff;
|
||||||
|
border: 0;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
opacity: 1;
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen::before {
|
||||||
|
width: 20px;
|
||||||
|
height: 50px;
|
||||||
|
background: -moz-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
|
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(100%, rgba(255, 255, 255, 0)));
|
||||||
|
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
|
background: -o-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
|
background: -ms-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
|
background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.fullscreen::after {
|
||||||
|
width: 20px;
|
||||||
|
height: 50px;
|
||||||
|
background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
|
||||||
|
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(100%, rgba(255, 255, 255, 1)));
|
||||||
|
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
|
||||||
|
background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
|
||||||
|
background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
|
||||||
|
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button {
|
||||||
|
background: transparent;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none !important;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button.active,
|
||||||
|
.editor-toolbar button:hover {
|
||||||
|
background: #fcfcfc;
|
||||||
|
border-color: #95a5a6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar i.separator {
|
||||||
|
display: inline-block;
|
||||||
|
width: 0;
|
||||||
|
border-left: 1px solid #d9d9d9;
|
||||||
|
border-right: 1px solid #fff;
|
||||||
|
color: transparent;
|
||||||
|
text-indent: -10px;
|
||||||
|
margin: 0 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button:after {
|
||||||
|
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
|
||||||
|
font-size: 65%;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
position: relative;
|
||||||
|
top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button.heading-1:after {
|
||||||
|
content: "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button.heading-2:after {
|
||||||
|
content: "2";
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button.heading-3:after {
|
||||||
|
content: "3";
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button.heading-bigger:after {
|
||||||
|
content: "▲";
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar button.heading-smaller:after {
|
||||||
|
content: "▼";
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-toolbar.disabled-for-preview button:not(.no-disable) {
|
||||||
|
opacity: .6;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 700px) {
|
||||||
|
.editor-toolbar i.no-mobile {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar {
|
||||||
|
padding: 8px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #959694;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar span {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 4em;
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar .lines:before {
|
||||||
|
content: 'lines: '
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar .words:before {
|
||||||
|
content: 'words: '
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-statusbar .characters:before {
|
||||||
|
content: 'characters: '
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview {
|
||||||
|
padding: 10px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background: #fafafa;
|
||||||
|
z-index: 7;
|
||||||
|
overflow: auto;
|
||||||
|
display: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview-side {
|
||||||
|
padding: 10px;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
width: 50%;
|
||||||
|
top: 50px;
|
||||||
|
right: 0;
|
||||||
|
background: #fafafa;
|
||||||
|
z-index: 9;
|
||||||
|
overflow: auto;
|
||||||
|
display: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview-active-side {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview-active {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview>p,
|
||||||
|
.editor-preview-side>p {
|
||||||
|
margin-top: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview pre,
|
||||||
|
.editor-preview-side pre {
|
||||||
|
background: #eee;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-preview table td,
|
||||||
|
.editor-preview table th,
|
||||||
|
.editor-preview-side table td,
|
||||||
|
.editor-preview-side table th {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-tag {
|
||||||
|
color: #63a35c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-attribute {
|
||||||
|
color: #795da3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-string {
|
||||||
|
color: #183691;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-header-1 {
|
||||||
|
font-size: 200%;
|
||||||
|
line-height: 200%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-header-2 {
|
||||||
|
font-size: 160%;
|
||||||
|
line-height: 160%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-header-3 {
|
||||||
|
font-size: 125%;
|
||||||
|
line-height: 125%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-header-4 {
|
||||||
|
font-size: 110%;
|
||||||
|
line-height: 110%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-comment {
|
||||||
|
background: rgba(0, 0, 0, .05);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-link {
|
||||||
|
color: #7f8c8d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-url {
|
||||||
|
color: #aab2b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-easymde .cm-quote {
|
||||||
|
color: #7f8c8d;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
@ -1,10 +1,28 @@
|
|||||||
|
.container> :last-child {
|
||||||
|
margin-bottom: 15px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vault-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
grid-gap: 1rem;
|
||||||
|
grid-auto-rows: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 50rem) {
|
||||||
|
.vault-list {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Media Query for small screens
|
||||||
|
|
||||||
.vault-vault {
|
.vault-vault {
|
||||||
width: 100%;
|
overflow: hidden;
|
||||||
|
|
||||||
>div {
|
>div {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 1rem;
|
font-size: 1.1rem;
|
||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@ -23,21 +41,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// .vault_vault {
|
|
||||||
// padding: 0.5rem;
|
|
||||||
// border-bottom: solid 1px var(--card-border-color);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .vault_vault:hover {
|
|
||||||
// background: var(--nav-hover-back-color);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .vault_vault>svg {
|
|
||||||
// height: 2rem;
|
|
||||||
// margin-right: 1rem;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .vault_vault:last-child {
|
|
||||||
// border-bottom: none;
|
|
||||||
// }
|
|
@ -4,6 +4,7 @@ import Notes, { VaultList } from "../../../notes";
|
|||||||
import "./vaults.scss"
|
import "./vaults.scss"
|
||||||
import Lock from "feather-icons/dist/icons/lock.svg";
|
import Lock from "feather-icons/dist/icons/lock.svg";
|
||||||
import Unlock from "feather-icons/dist/icons/unlock.svg";
|
import Unlock from "feather-icons/dist/icons/unlock.svg";
|
||||||
|
import Settings from "feather-icons/dist/icons/settings.svg"
|
||||||
import Navigation from "../../../navigation";
|
import Navigation from "../../../navigation";
|
||||||
import { InputModal } from "../../modals/InputModal";
|
import { InputModal } from "../../modals/InputModal";
|
||||||
import { YesNoModal } from "../../modals/YesNoModal";
|
import { YesNoModal } from "../../modals/YesNoModal";
|
||||||
@ -127,21 +128,22 @@ export default class VaultsPage extends Page<VaultsProps, { vaults: VaultList, m
|
|||||||
|
|
||||||
onContext(evt: MouseEvent, vault: { name: string, encrypted: boolean, id: string }) {
|
onContext(evt: MouseEvent, vault: { name: string, encrypted: boolean, id: string }) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
evt.stopPropagation();
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
window.removeEventListener("click", close);
|
document.documentElement.removeEventListener("click", close);
|
||||||
this.setState({ context: undefined });
|
this.setState({ context: undefined });
|
||||||
}
|
}
|
||||||
window.addEventListener("click", close);
|
document.documentElement.addEventListener("click", close);
|
||||||
|
|
||||||
let deleteb = <button class="uk-button" onClick={async () => {
|
let deleteb = <button class="btn" onClick={async () => {
|
||||||
let delete_modal = new YesNoModal("Delete Vault? Cannot be undone!");
|
let delete_modal = new YesNoModal("Delete Vault? Cannot be undone!");
|
||||||
let result = await delete_modal.getResult();
|
let result = await delete_modal.getResult();
|
||||||
if (result) {
|
if (result) {
|
||||||
Notes.deleteVault(vault.id).then(() => {
|
Notes.deleteVault(vault.id).then(() => {
|
||||||
this.updateVaults();
|
this.updateVaults();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
Notifications.sendError("error deleting vault!")
|
Notifications.sendError("Error deleting vault!")
|
||||||
console.error(err);
|
console.error(err);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -151,15 +153,15 @@ export default class VaultsPage extends Page<VaultsProps, { vaults: VaultList, m
|
|||||||
|
|
||||||
let delete_key;
|
let delete_key;
|
||||||
if (Notes.getVaultKey(vault.id)) {
|
if (Notes.getVaultKey(vault.id)) {
|
||||||
delete_key = <button class="uk-button" onClick={() => {
|
delete_key = <button class="btn" onClick={() => {
|
||||||
Notes.forgetVaultKey(vault.id);
|
Notes.forgetVaultKey(vault.id);
|
||||||
Notifications.sendSuccess("Forgot key!")
|
Notifications.sendSuccess("Forgot password!")
|
||||||
}}>
|
}}>
|
||||||
forget password
|
forget password
|
||||||
</button>;
|
</button>;
|
||||||
}
|
}
|
||||||
|
|
||||||
let exportb = <button class="uk-button" onClick={async () => {
|
let exportb = <button class="btn" onClick={async () => {
|
||||||
let key: Uint8Array;
|
let key: Uint8Array;
|
||||||
if (vault.encrypted) {
|
if (vault.encrypted) {
|
||||||
await this.getKey(vault, false)
|
await this.getKey(vault, false)
|
||||||
@ -216,14 +218,14 @@ export default class VaultsPage extends Page<VaultsProps, { vaults: VaultList, m
|
|||||||
return <div style={{ marginTop: "-12px", paddingTop: "12px" }} >
|
return <div style={{ marginTop: "-12px", paddingTop: "12px" }} >
|
||||||
{/* {this.state.modal} */}
|
{/* {this.state.modal} */}
|
||||||
{this.state.context}
|
{this.state.context}
|
||||||
<header class="uk-background-primary">
|
<header class="header">
|
||||||
<span></span>
|
|
||||||
<h3 style="display:inline" class="header_title" onClick={() => Navigation.setPage("/")}>Your vaults:</h3>
|
|
||||||
<span></span>
|
<span></span>
|
||||||
|
<h3 style="display:inline" onClick={() => Navigation.setPage("/")}>{this.props.selectVault ? "Select Vault for share" : "Your vaults:"}</h3>
|
||||||
|
<a class="header-icon-button" onClick={() => Navigation.setPage("/settings")}><Settings height={undefined} width={undefined} /></a>
|
||||||
</header>
|
</header>
|
||||||
<AddButton onClick={() => this.addButtonClick()} />
|
<AddButton onClick={() => this.addButtonClick()} />
|
||||||
<div class="uk-container">
|
<div class="container">
|
||||||
<ul class="uk-list uk-list-divider">
|
<ul class="list list-divider list-clickable">
|
||||||
{elms}
|
{elms}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,23 +1,19 @@
|
|||||||
@import "../../../vars.scss";
|
|
||||||
|
|
||||||
.vaults_vault {
|
.vaults_vault {
|
||||||
|
display: flex;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
margin-top: 0 !important;
|
margin-top: 0 !important;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: start;
|
||||||
|
|
||||||
// >span {
|
>span {
|
||||||
// font-size: 2rem !important;
|
font-size: 1.5rem;
|
||||||
// }
|
line-height: 1.5rem;
|
||||||
|
}
|
||||||
// &:not(:last-child) {
|
|
||||||
// border-bottom: 1px $border_color solid;
|
|
||||||
// }
|
|
||||||
|
|
||||||
>svg {
|
>svg {
|
||||||
height: 2rem;
|
display: inline-block;
|
||||||
|
height: 1.5em;
|
||||||
|
width: 1.5em;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $hover-background;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -5,7 +5,6 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding-bottom: 40px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.transition_slidein {
|
.transition_slidein {
|
||||||
@ -21,6 +20,7 @@
|
|||||||
from {
|
from {
|
||||||
left: 100%;
|
left: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
left: 0%;
|
left: 0%;
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { Lock } from "@hibas123/utils";
|
import { Lock } from "@hibas123/utils";
|
||||||
|
|
||||||
import { DB, openDb, Transaction } from "idb";
|
import { openDB, IDBPDatabase, IDBPTransaction, } from "idb";
|
||||||
|
|
||||||
export default class IDB {
|
export default class IDB {
|
||||||
initLock = new Lock();
|
initLock = new Lock();
|
||||||
db: DB;
|
db: IDBPDatabase;
|
||||||
constructor(database: string, private stores: string[]) {
|
constructor(database: string, private stores: string[]) {
|
||||||
let lock = this.initLock.getLock();
|
this.initLock.getLock().then(async l => {
|
||||||
lock.then(async l => {
|
|
||||||
|
|
||||||
let v = localStorage.getItem(database + "_version");
|
let v = localStorage.getItem(database + "_version");
|
||||||
let version = 0;
|
let version = 0;
|
||||||
if (v) version = Number(v)
|
if (v) version = Number(v)
|
||||||
@ -21,12 +19,15 @@ export default class IDB {
|
|||||||
localStorage.setItem(database + "_version", version.toString());
|
localStorage.setItem(database + "_version", version.toString());
|
||||||
localStorage.setItem(database + "_stores", stores.join(","));
|
localStorage.setItem(database + "_stores", stores.join(","));
|
||||||
|
|
||||||
this.db = await openDb(database, version, db => {
|
this.db = await openDB(database, version, {
|
||||||
|
upgrade: (db) => {
|
||||||
console.log("IndexedDB need update")
|
console.log("IndexedDB need update")
|
||||||
|
const check = name => (<any>db.objectStoreNames as DOMStringList).contains ? (<any>db.objectStoreNames as DOMStringList).contains(name) : db.objectStoreNames.find(e => e === name);
|
||||||
stores.forEach(store => {
|
stores.forEach(store => {
|
||||||
if (!db.objectStoreNames.contains(store))
|
if (!check(store))
|
||||||
db.createObjectStore(store);
|
db.createObjectStore(store);
|
||||||
})
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
console.log("Got DATABASE", this.db)
|
console.log("Got DATABASE", this.db)
|
||||||
l.release();
|
l.release();
|
||||||
@ -48,42 +49,42 @@ export default class IDB {
|
|||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
transaction: () => {
|
transaction: () => {
|
||||||
return this.db.transaction(name, "readwrite")
|
return <any>this.db.transaction(name, "readwrite") as IDBPTransaction<unknown, string[]>;
|
||||||
},
|
},
|
||||||
get: async (key: string, transaction?: Transaction): Promise<T> => {
|
get: async (key: string, transaction?: IDBPTransaction<unknown, string[]>): Promise<T> => {
|
||||||
(await this.initLock.getLock()).release()
|
(await this.initLock.getLock()).release()
|
||||||
return (transaction || this.db.transaction(name))
|
return (transaction || this.db.transaction(name))
|
||||||
.objectStore(name).get(key);
|
.objectStore(name).get(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
getAll: async (transaction?: Transaction): Promise<T[]> => {
|
getAll: async (transaction?: IDBPTransaction<unknown, string[]>): Promise<T[]> => {
|
||||||
(await this.initLock.getLock()).release()
|
(await this.initLock.getLock()).release()
|
||||||
return (transaction || this.db.transaction(name))
|
return (transaction || this.db.transaction(name))
|
||||||
.objectStore(name).getAll();
|
.objectStore(name).getAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
set: async (key: string, val: T, transaction?: Transaction) => {
|
set: async (key: string, val: T, transaction?: IDBPTransaction<unknown, string[]>) => {
|
||||||
(await this.initLock.getLock()).release()
|
(await this.initLock.getLock()).release()
|
||||||
const tx = (transaction || this.db.transaction(name, "readwrite"));
|
const tx = (transaction || this.db.transaction(name, "readwrite"));
|
||||||
tx.objectStore(name).put(val, key);
|
tx.objectStore(name).put(val, key);
|
||||||
return tx.complete;
|
return tx.done;
|
||||||
},
|
},
|
||||||
|
|
||||||
delete: async (key: string, transaction?: Transaction) => {
|
delete: async (key: string, transaction?: IDBPTransaction<unknown, string[]>) => {
|
||||||
(await this.initLock.getLock()).release()
|
(await this.initLock.getLock()).release()
|
||||||
const tx = (transaction || this.db.transaction(name, "readwrite"));
|
const tx = (transaction || this.db.transaction(name, "readwrite"));
|
||||||
tx.objectStore(name).delete(key);
|
tx.objectStore(name).delete(key);
|
||||||
return tx.complete;
|
return tx.done;
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: async (transaction?: Transaction) => {
|
clear: async (transaction?: IDBPTransaction<unknown, string[]>) => {
|
||||||
(await this.initLock.getLock()).release()
|
(await this.initLock.getLock()).release()
|
||||||
const tx = (transaction || this.db.transaction(name, "readwrite"));
|
const tx = (transaction || this.db.transaction(name, "readwrite"));
|
||||||
tx.objectStore(name).clear();
|
tx.objectStore(name).clear();
|
||||||
return tx.complete;
|
return tx.done;
|
||||||
},
|
},
|
||||||
|
|
||||||
keys: async (transaction?: Transaction): Promise<string[]> => {
|
keys: async (transaction?: IDBPTransaction<unknown, string[]>): Promise<string[]> => {
|
||||||
(await this.initLock.getLock()).release()
|
(await this.initLock.getLock()).release()
|
||||||
const tx = (transaction || this.db.transaction(name));
|
const tx = (transaction || this.db.transaction(name));
|
||||||
const keys: string[] = [];
|
const keys: string[] = [];
|
||||||
@ -91,13 +92,15 @@ export default class IDB {
|
|||||||
|
|
||||||
// This would be store.getAllKeys(), but it isn't supported by Edge or Safari.
|
// This would be store.getAllKeys(), but it isn't supported by Edge or Safari.
|
||||||
// openKeyCursor isn't supported by Safari, so we fall back
|
// openKeyCursor isn't supported by Safari, so we fall back
|
||||||
(store.iterateKeyCursor || store.iterateCursor).call(store, (cursor: any) => {
|
store.getAllKeys()
|
||||||
if (!cursor) return;
|
|
||||||
keys.push(cursor.key);
|
|
||||||
cursor.continue();
|
|
||||||
});
|
|
||||||
|
|
||||||
return tx.complete.then(() => keys);
|
// (store.iterateKeyCursor || store.iterateCursor).call(store, (cursor: any) => {
|
||||||
|
// if (!cursor) return;
|
||||||
|
// keys.push(cursor.key);
|
||||||
|
// cursor.continue();
|
||||||
|
// });
|
||||||
|
|
||||||
|
return tx.done.then(() => keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3E9AE9">
|
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#1E88E5">
|
||||||
<meta name="msapplication-TileColor" content="#3E9AE9">
|
<script src="encoding.js"></script>
|
||||||
<meta name="theme-color" content="#3E9AE9">
|
<meta name="msapplication-TileColor" content="#1E88E5">
|
||||||
|
<meta name="theme-color" content="#1E88E5">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -1,64 +1,53 @@
|
|||||||
@import "./vars.scss";
|
@import "./vars.scss";
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
// html {
|
||||||
font-family: 'Roboto', sans-serif; // font-family: Verdana, Geneva, sans-serif;
|
// min-height: 100%;
|
||||||
font-size: 18px;
|
// display: flex;
|
||||||
width: 100%;
|
// }
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
// $header-margin: .5em;
|
||||||
min-height: 100%;
|
// $header-icon-size: calc(1.5rem * 1);
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
$header-margin: .5em;
|
|
||||||
$header-icon-size: calc(1.5rem * 1);
|
|
||||||
// $header-icon-size: 100%;
|
// $header-icon-size: 100%;
|
||||||
|
|
||||||
header {
|
// header {
|
||||||
display: flex;
|
// display: flex;
|
||||||
justify-content: space-between;
|
// justify-content: space-between;
|
||||||
margin-bottom: $header-margin;
|
// margin-bottom: $header-margin;
|
||||||
align-content: center;
|
// align-content: center;
|
||||||
padding: 0.75em;
|
// padding: 0.75em;
|
||||||
border-bottom: solid var(--border-color) 1px;
|
// border-bottom: solid var(--border-color) 1px;
|
||||||
background-color: var(--primary);
|
// background-color: var(--primary);
|
||||||
|
|
||||||
>* {
|
// >* {
|
||||||
margin: 0;
|
// margin: 0;
|
||||||
}
|
// color: white;
|
||||||
|
// background: var(--primary);
|
||||||
|
// }
|
||||||
|
|
||||||
>.header-title {
|
// >.header-title {
|
||||||
overflow: hidden;
|
// overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
// text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
// text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
// white-space: nowrap;
|
||||||
overflow: hidden;
|
// overflow: hidden;
|
||||||
flex-grow: 1;
|
// flex-grow: 1;
|
||||||
margin: 0 1em;
|
// margin: 0 1em;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.header-icon-button {
|
// .header-icon-button {
|
||||||
display: block;
|
// display: block;
|
||||||
margin-top: auto;
|
// margin-top: auto;
|
||||||
margin-bottom: auto;
|
// margin-bottom: auto;
|
||||||
color: black;
|
// min-width: $header-icon-size;
|
||||||
min-width: $header-icon-size;
|
|
||||||
|
|
||||||
>svg {
|
// >svg {
|
||||||
height: $header-icon-size;
|
// height: $header-icon-size;
|
||||||
width: $header-icon-size;
|
// width: $header-icon-size;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
.def-shadow {
|
.def-shadow {
|
||||||
box-shadow: 0px 5px 8px 2px rgba(66, 66, 66, 0.53);
|
box-shadow: 0px 5px 8px 2px rgba(66, 66, 66, 0.53);
|
||||||
|
@ -5,32 +5,32 @@ declare global {
|
|||||||
debug: any;
|
debug: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace JSX {
|
// namespace JSX {
|
||||||
interface IntrinsicElements {
|
// interface IntrinsicElements {
|
||||||
"wired-button": HTMLAttributes;
|
// "wired-button": HTMLAttributes;
|
||||||
"wired-card": HTMLAttributes;
|
// "wired-card": HTMLAttributes;
|
||||||
"wired-checkbox": HTMLAttributes;
|
// "wired-checkbox": HTMLAttributes;
|
||||||
"wired-combo": HTMLAttributes;
|
// "wired-combo": HTMLAttributes;
|
||||||
"wired-fab": HTMLAttributes;
|
// "wired-fab": HTMLAttributes;
|
||||||
"wired-icon-button": HTMLAttributes;
|
// "wired-icon-button": HTMLAttributes;
|
||||||
"wired-input": HTMLAttributes;
|
// "wired-input": HTMLAttributes;
|
||||||
"wired-item": HTMLAttributes;
|
// "wired-item": HTMLAttributes;
|
||||||
"wired-lib": HTMLAttributes;
|
// "wired-lib": HTMLAttributes;
|
||||||
"wired-listbox": HTMLAttributes;
|
// "wired-listbox": HTMLAttributes;
|
||||||
"wired-progress": HTMLAttributes;
|
// "wired-progress": HTMLAttributes;
|
||||||
"wired-radio-group": HTMLAttributes;
|
// "wired-radio-group": HTMLAttributes;
|
||||||
"wired-radio": HTMLAttributes;
|
// "wired-radio": HTMLAttributes;
|
||||||
"wired-slider": HTMLAttributes;
|
// "wired-slider": HTMLAttributes;
|
||||||
"wired-spinner": HTMLAttributes;
|
// "wired-spinner": HTMLAttributes;
|
||||||
"wired-tabs": HTMLAttributes;
|
// "wired-tabs": HTMLAttributes;
|
||||||
"wired-textarea": HTMLAttributes;
|
// "wired-textarea": HTMLAttributes;
|
||||||
"wired-toggle": HTMLAttributes;
|
// "wired-toggle": HTMLAttributes;
|
||||||
"wired-tooltip": HTMLAttributes;
|
// "wired-tooltip": HTMLAttributes;
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
declare const window: Window;
|
||||||
}
|
|
||||||
// declare const window: Window;
|
|
||||||
|
|
||||||
window.requestIdleCallback =
|
window.requestIdleCallback =
|
||||||
window.requestIdleCallback ||
|
window.requestIdleCallback ||
|
||||||
@ -53,32 +53,35 @@ window.cancelIdleCallback =
|
|||||||
clearTimeout(id as any);
|
clearTimeout(id as any);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(window.requestIdleCallback);
|
// console.log(window.requestIdleCallback);
|
||||||
|
|
||||||
window.debug = {};
|
window.debug = {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import "@hibas123/theme/out/base.css";
|
||||||
import { h, render } from 'preact';
|
import { h, render } from 'preact';
|
||||||
import App from './components/App';
|
import App from './components/App';
|
||||||
|
import DemoPage from './components/demo';
|
||||||
|
import Error404Page from './components/routes/404';
|
||||||
import "uikit";
|
import SettingsPage from './components/routes/settings/Settings';
|
||||||
import "uikit/dist/css/uikit.css"
|
import SharePage from './components/routes/share/Share';
|
||||||
|
import VaultPage from './components/routes/vault/Vault';
|
||||||
|
import VaultsPage from './components/routes/vaults/Vaults';
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
import Navigation from './navigation';
|
import Navigation from './navigation';
|
||||||
import VaultsPage from './components/routes/vaults/Vaults';
|
import Notes from "./notes";
|
||||||
|
import Notifications from './notifications';
|
||||||
import { Page } from './page';
|
import { Page } from './page';
|
||||||
|
|
||||||
import Notes from "./notes"
|
|
||||||
import DemoPage from './components/demo';
|
|
||||||
import VaultPage from './components/routes/vault/Vault';
|
|
||||||
import SharePage from './components/routes/share/Share';
|
|
||||||
import Notifications from './notifications';
|
|
||||||
window.debug.notes = Notes;
|
window.debug.notes = Notes;
|
||||||
|
|
||||||
|
|
||||||
|
// import Theme from "./theme";
|
||||||
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
// Initialize notes provider
|
// Initialize notes provider
|
||||||
if (Notes.loginRequired()) {
|
if (Notes.loginRequired()) {
|
||||||
@ -89,21 +92,38 @@ window.debug.notes = Notes;
|
|||||||
let err = await Notes.getToken(code)
|
let err = await Notes.getToken(code)
|
||||||
if (err) {
|
if (err) {
|
||||||
Notifications.sendError("Login failed: " + err)
|
Notifications.sendError("Login failed: " + err)
|
||||||
Notes.login()
|
return Notes.login()
|
||||||
} else {
|
} else {
|
||||||
window.history.replaceState(null, document.title, "/" + window.location.hash);
|
window.history.replaceState(null, document.title, "/" + window.location.hash);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Notes.login()
|
return Notes.login()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Notes.start();
|
await Notes.start();
|
||||||
|
|
||||||
|
if (window.navigator.storage && navigator.storage.persist) {
|
||||||
|
navigator.storage.persisted()
|
||||||
|
.then(has => has ? true : navigator.storage.persist())
|
||||||
|
.then(is => {
|
||||||
|
console.log("Persistant Storage:", is);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
Navigation.default = VaultsPage as typeof Page;
|
Navigation.default = VaultsPage as typeof Page;
|
||||||
Navigation.addPage("/vault", VaultPage as typeof Page)
|
Navigation.addPage("/vault", VaultPage as typeof Page)
|
||||||
Navigation.addPage("/demo", DemoPage as typeof Page)
|
Navigation.addPage("/demo", DemoPage as typeof Page)
|
||||||
Navigation.addPage("/share", SharePage as typeof Page)
|
Navigation.addPage("/share", SharePage as typeof Page)
|
||||||
|
Navigation.addPage("/settings", SettingsPage as typeof Page)
|
||||||
|
Navigation.addPage("/404", Error404Page);
|
||||||
|
const trad = window.location.pathname;
|
||||||
|
if (trad && trad !== "/" && trad !== "") {
|
||||||
|
let p: any = {};
|
||||||
|
new URL(window.location.href).searchParams.forEach((val, key) => p[key] = val);
|
||||||
|
Navigation.setPage(trad, p, undefined, true);
|
||||||
|
// window.location.href = "/#/" + trad;
|
||||||
|
}
|
||||||
Navigation.start();
|
Navigation.start();
|
||||||
|
|
||||||
render(<App />, document.body, document.getElementById('app'));
|
render(<App />, document.body, document.getElementById('app'));
|
||||||
|
@ -23,9 +23,10 @@ function parseQuery(query: string) {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PageFunction = () => JSX.Element;
|
||||||
|
|
||||||
export default class Navigation {
|
export default class Navigation {
|
||||||
private static _pages: Map<string, typeof Page> = new Map();
|
private static _pages: Map<string, typeof Page | PageFunction> = new Map();
|
||||||
private static _page: { route: string, page: JSX.Element };
|
private static _page: { route: string, page: JSX.Element };
|
||||||
private static pageObservableServer = new Observable<JSX.Element>();
|
private static pageObservableServer = new Observable<JSX.Element>();
|
||||||
public static pageObservable = Navigation.pageObservableServer.getPublicApi();
|
public static pageObservable = Navigation.pageObservableServer.getPublicApi();
|
||||||
@ -34,7 +35,7 @@ export default class Navigation {
|
|||||||
|
|
||||||
private static _page_cache = new Map<string, VNode<any>>();
|
private static _page_cache = new Map<string, VNode<any>>();
|
||||||
|
|
||||||
public static addPage(route: string, comp: typeof Page) {
|
public static addPage(route: string, comp: typeof Page | PageFunction) {
|
||||||
Navigation._pages.set(route, comp);
|
Navigation._pages.set(route, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,9 +70,9 @@ export default class Navigation {
|
|||||||
let oldkey = whash + serializQuery(history.state);
|
let oldkey = whash + serializQuery(history.state);
|
||||||
if (newkey !== oldkey) {
|
if (newkey !== oldkey) {
|
||||||
if (replace)
|
if (replace)
|
||||||
window.history.replaceState(hidden, document.title, newhash);
|
window.history.replaceState(hidden, document.title, "./" + newhash);
|
||||||
else
|
else
|
||||||
window.history.pushState(hidden, document.title, newhash);
|
window.history.pushState(hidden, document.title, "./" + newhash);
|
||||||
}
|
}
|
||||||
let page = this._page_cache.get(newkey);
|
let page = this._page_cache.get(newkey);
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
29
src/notes.ts
29
src/notes.ts
@ -1,8 +1,14 @@
|
|||||||
import * as config from "../config.json"
|
|
||||||
import { Lock, Observable } from "@hibas123/utils"
|
|
||||||
|
|
||||||
import SecureFile, { IFile } from "@hibas123/secure-file-wrapper";
|
import SecureFile, { IFile } from "@hibas123/secure-file-wrapper";
|
||||||
import * as b64 from "./helper/base64"
|
import { Lock, Observable } from "@hibas123/utils";
|
||||||
|
import * as aesjs from "aes-js";
|
||||||
|
import { IDBPTransaction } from "idb";
|
||||||
|
import { sha256 } from "js-sha256";
|
||||||
|
import * as uuidv4 from "uuid/v4";
|
||||||
|
import * as config from "../config.json";
|
||||||
|
import * as b64 from "./helper/base64";
|
||||||
|
import IDB from "./helper/indexeddb";
|
||||||
|
import Notifications, { MessageType } from "./notifications";
|
||||||
|
|
||||||
|
|
||||||
export class HttpError extends Error {
|
export class HttpError extends Error {
|
||||||
constructor(public status: number, public statusText: string) {
|
constructor(public status: number, public statusText: string) {
|
||||||
@ -32,13 +38,7 @@ export interface ViewNote extends BaseNote {
|
|||||||
__value: string;
|
__value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
import * as aesjs from "aes-js";
|
|
||||||
import { sha256 } from "js-sha256"
|
|
||||||
import clonedeep = require("lodash.clonedeep");
|
import clonedeep = require("lodash.clonedeep");
|
||||||
import * as uuidv4 from "uuid/v4"
|
|
||||||
import IDB from "./helper/indexeddb";
|
|
||||||
import { Transaction } from "idb";
|
|
||||||
import Notifications, { MessageType } from "./notifications";
|
|
||||||
|
|
||||||
const Encoder = new TextEncoder();
|
const Encoder = new TextEncoder();
|
||||||
const Decoder = new TextDecoder();
|
const Decoder = new TextDecoder();
|
||||||
@ -172,7 +172,7 @@ class NotesProvider {
|
|||||||
}
|
}
|
||||||
this.syncedObservableServer.send((await this.oplogDB.getAll()).length <= 0);
|
this.syncedObservableServer.send((await this.oplogDB.getAll()).length <= 0);
|
||||||
let prs = this.apiLockRls.then(lock => lock.release());
|
let prs = this.apiLockRls.then(lock => lock.release());
|
||||||
prs.then(() => awaitTimeout(5000)).then(() => this.sync()).then(() => next());
|
prs.then(() => awaitTimeout(2000)).then(() => this.sync()).then(() => next());
|
||||||
return prs;
|
return prs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ class NotesProvider {
|
|||||||
return Decoder.decode(this._decrypt(msg, this.generalEncryption))
|
return Decoder.decode(this._decrypt(msg, this.generalEncryption))
|
||||||
}
|
}
|
||||||
|
|
||||||
async addop(note_id: string, type: OpLogType, values: { value: Uint8Array, preview: Uint8Array }, date: Date, transaction?: Transaction) {
|
async addop(note_id: string, type: OpLogType, values: { value: Uint8Array, preview: Uint8Array }, date: Date, transaction?: IDBPTransaction<unknown, string[]>) {
|
||||||
let tx = transaction || this.oplogDB.transaction();
|
let tx = transaction || this.oplogDB.transaction();
|
||||||
let oplog = await this.oplogDB.get(note_id, tx);
|
let oplog = await this.oplogDB.get(note_id, tx);
|
||||||
if (!oplog) oplog = { logs: [], id: note_id };
|
if (!oplog) oplog = { logs: [], id: note_id };
|
||||||
@ -524,6 +524,7 @@ class NotesProvider {
|
|||||||
async getAllNotes() {
|
async getAllNotes() {
|
||||||
return Notes.noteDB.getAll()
|
return Notes.noteDB.getAll()
|
||||||
.then(all => all.filter(e => e.folder === this.vault._id)
|
.then(all => all.filter(e => e.folder === this.vault._id)
|
||||||
|
.sort(this.sort)
|
||||||
.map<BaseNote>(e => {
|
.map<BaseNote>(e => {
|
||||||
let new_note = clonedeep(<Note>e) as BaseNote
|
let new_note = clonedeep(<Note>e) as BaseNote
|
||||||
delete (<any>new_note).__value
|
delete (<any>new_note).__value
|
||||||
@ -532,6 +533,10 @@ class NotesProvider {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sort(a: DBNote, b: DBNote) {
|
||||||
|
return new Date(b.time).getTime() - new Date(a.time).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
async searchNote(term: string) {
|
async searchNote(term: string) {
|
||||||
let all = await this.getAllNotes();
|
let all = await this.getAllNotes();
|
||||||
return all.filter(e => e.preview.indexOf(term) >= 0)
|
return all.filter(e => e.preview.indexOf(term) >= 0)
|
||||||
|
52
src/theme.ts
Normal file
52
src/theme.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
const light = require("!!raw-loader!@hibas123/theme/out/light.css").default;
|
||||||
|
const dark = require("!!raw-loader!@hibas123/theme/out/dark.css").default;
|
||||||
|
|
||||||
|
export enum ThemeStates {
|
||||||
|
AUTO,
|
||||||
|
LIGHT,
|
||||||
|
DARK
|
||||||
|
}
|
||||||
|
|
||||||
|
let themeConfig: ThemeStates = Number(localStorage.getItem("theme"));
|
||||||
|
if (Number.isNaN(themeConfig))
|
||||||
|
themeConfig = ThemeStates.AUTO;
|
||||||
|
|
||||||
|
let isDark = false;
|
||||||
|
let mediaIsDark = false;
|
||||||
|
|
||||||
|
if (window.matchMedia) {
|
||||||
|
const mediaq = matchMedia("(prefers-color-scheme: dark)");
|
||||||
|
mediaIsDark = mediaq.matches;
|
||||||
|
mediaq.onchange = ev => {
|
||||||
|
mediaIsDark = ev.matches;
|
||||||
|
apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let styleElm: HTMLStyleElement;
|
||||||
|
function apply(force?: boolean) {
|
||||||
|
let shouldDark = themeConfig === ThemeStates.AUTO ? mediaIsDark : themeConfig === ThemeStates.DARK;
|
||||||
|
if (force || shouldDark !== isDark) {
|
||||||
|
if (styleElm) styleElm.remove();
|
||||||
|
styleElm = document.createElement("style");
|
||||||
|
document.head.appendChild(styleElm);
|
||||||
|
styleElm.innerHTML = shouldDark ? dark : light;
|
||||||
|
isDark = shouldDark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
apply(true);
|
||||||
|
|
||||||
|
|
||||||
|
function change(state: ThemeStates) {
|
||||||
|
themeConfig = state;
|
||||||
|
localStorage.setItem("theme", String(themeConfig));
|
||||||
|
apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
active: () => themeConfig,
|
||||||
|
change: (state: ThemeStates) => change(state),
|
||||||
|
isDark: () => isDark
|
||||||
|
}
|
||||||
|
|
@ -1,21 +1,9 @@
|
|||||||
:root {
|
:root {
|
||||||
--primary: #1E88E5;
|
--primary: #1E88E5;
|
||||||
|
--on-primary: white;
|
||||||
// --mdc-theme-primary: var(--primary);
|
// --mdc-theme-primary: var(--primary);
|
||||||
// --mdc-theme-primary-bg: var(--mdc-theme--primary);
|
// --mdc-theme-primary-bg: var(--mdc-theme--primary);
|
||||||
// --mdc-theme-on-primary: white;
|
// --mdc-theme-on-primary: white;
|
||||||
--error: #ff2f00;
|
--error: #ff2f00;
|
||||||
--border-color: #ababab;
|
--border-color: #ababab;
|
||||||
--default-font-size: 1.05rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.uk-button-primary {
|
|
||||||
background: var(--primary) !important;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uk-background-primary {
|
|
||||||
background: var(--primary) !important;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
$hover-background: #DDDDDD;
|
|
@ -1,5 +1,4 @@
|
|||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
const WorkboxPlugin = require("workbox-webpack-plugin");
|
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||||
@ -25,7 +24,9 @@ module.exports = {
|
|||||||
public: url.parse(config.callback_url).hostname
|
public: url.parse(config.callback_url).hostname
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CopyWebpackPlugin([{ from: "public" }]),
|
new CopyWebpackPlugin([{
|
||||||
|
from: "public"
|
||||||
|
}]),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
title: 'SecureNotes',
|
title: 'SecureNotes',
|
||||||
template: "./src/index.html"
|
template: "./src/index.html"
|
||||||
@ -39,40 +40,18 @@ module.exports = {
|
|||||||
openAnalyzer: false
|
openAnalyzer: false
|
||||||
}),
|
}),
|
||||||
new Visualizer(),
|
new Visualizer(),
|
||||||
// new WorkboxPlugin.GenerateSW({
|
|
||||||
// swDest: "sw.js",
|
|
||||||
// importWorkboxFrom: 'local',
|
|
||||||
// clientsClaim: true,
|
|
||||||
// // importsDirectory: "/dist",
|
|
||||||
// directoryIndex: 'index.html',
|
|
||||||
// ignoreURLParametersMatching: [/./],
|
|
||||||
// runtimeCaching: [{
|
|
||||||
// urlPattern: /images/,
|
|
||||||
// handler: 'CacheFirst',
|
|
||||||
// options: {
|
|
||||||
// cacheName: 'images',
|
|
||||||
// expiration: {
|
|
||||||
// maxEntries: 1000,
|
|
||||||
// //Recheck after 30 Days
|
|
||||||
// maxAgeSeconds: 30 * 24 * 60 * 60
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// }, {
|
|
||||||
// urlPattern: /api/,
|
|
||||||
// handler: 'NetworkOnly'
|
|
||||||
// }]
|
|
||||||
// })
|
|
||||||
],
|
],
|
||||||
entry: "./src/index.tsx",
|
entry: {
|
||||||
|
main: "./src/index.tsx"
|
||||||
|
},
|
||||||
// Enable sourcemaps for debugging webpack's output.
|
// Enable sourcemaps for debugging webpack's output.
|
||||||
devtool: "eval",
|
devtool: "eval",
|
||||||
resolve: {
|
resolve: {
|
||||||
// Add '.ts' and '.tsx' as resolvable extensions.
|
// Add '.ts' and '.tsx' as resolvable extensions.
|
||||||
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
|
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js", ".mjs"]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [{
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
test: /\.tsx?$/,
|
||||||
use: 'ts-loader',
|
use: 'ts-loader',
|
||||||
exclude: /node_modules/
|
exclude: /node_modules/
|
||||||
|
Reference in New Issue
Block a user