A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: editor ui fixes and improvements
thecodrr29dc882f60a1
diff --git a/apps/web/package.json b/apps/web/package.jsonindex e3d5f180c..d23b443bf 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -22,6 +22,7 @@"qclone": "^1.0.4","quill": "https://github.com/thecodrr/quill.git#1.3.7","quill-magic-url": "^1.0.3",+ "quill-task-list": "https://github.com/CJEnright/quill-task-list","react": "^16.13.1","react-app-polyfill": "^1.0.6","react-dom": "^16.13.1",diff --git a/apps/web/src/components/editor/editor.css b/apps/web/src/components/editor/editor.cssindex 20da7e654..3c4098f6b 100644--- a/apps/web/src/components/editor/editor.css+++ b/apps/web/src/components/editor/editor.css@@ -16,15 +16,49 @@}.ql-toolbar.ql-snow span {padding-top: 1px;- font-size: 1.125em;+ font-size: 0.975em;}.ql-formats {margin-bottom: 5px;}-.ql-formats > * {- margin-left: 5px !important;+.ql-formats > span.ql-color-picker {+ padding: 0px !important;+ height: auto !important;+ width: auto !important;+}++.ql-formats > span.ql-color-picker > .ql-picker-label {+ padding: 5px !important;+ padding-bottom: 0px !important;+ height: auto !important;+ width: auto !important;+ border-radius: 5px;+ margin-left: 2px;+ margin-right: 2px;+}++.ql-formats > span.ql-header {+ padding: 0px !important;+ height: auto !important;+}++.ql-formats > span.ql-header > .ql-picker-label {+ padding: 5px !important;+ height: auto !important;+ border-radius: 5px;+ margin-left: 2px;+ margin-right: 2px;+}++.ql-formats > button {+ width: auto !important;+ height: auto !important;+ padding: 5px !important;+ border-radius: 5px;+ margin-left: 2px;+ margin-right: 2px;}.ql-header.ql-picker {@@ -55,6 +89,7 @@.ql-snow .ql-toolbar .ql-picker-label.ql-active {color: var(--primary) !important;fill: var(--primary) !important;+ background-color: var(--shade) !important;transition: color 300ms linear;}@@ -161,16 +196,16 @@.ql-editor .ql-syntax,code {font-family: monospace !important;- font-size: 0.875rem;+ font-size: 16px;}.ql-editor .ql-syntax * {font-family: monospace !important;- font-size: 0.875rem;+ font-size: 16px;}.ql-editor {- font-size: 0.875rem;+ font-size: 16px;color: var(--text) !important;padding: 10px 0px 10px 0px !important;}@@ -183,3 +218,16 @@ code {font-family: "Poppins", monospace !important;font-weight: 600 !important;}++.ql-editor ul[data-checked="false"] > li::before,+.ql-editor ul[data-checked="true"] > li::before {+ font-size: 20px;+}+.ql-editor ul[data-checked="true"] > li::before {+ color: var(--primary) !important;+}++.ql-editor ul[data-checked="true"] > li {+ text-decoration: line-through;+ text-decoration-color: var(--primary);+}diff --git a/apps/web/src/components/editor/react-quill.js b/apps/web/src/components/editor/react-quill.jsindex 93d8480c5..908e27b8d 100644--- a/apps/web/src/components/editor/react-quill.js+++ b/apps/web/src/components/editor/react-quill.js@@ -9,10 +9,29 @@ import { Text } from "rebass";Quill.register("modules/markdownShortcuts", MarkdownShortcuts);Quill.register("modules/magicUrl", MagicUrl);-const quillModules = {+const List = Quill.import("formats/list");++class BetterList extends List {+ constructor(el) {+ super(el);++ const isCheckList = el.hasAttribute("data-checked");+ el.addEventListener("touchstart", (e) => {+ if (!isCheckList) {+ return;+ }+ e.preventDefault();+ });+ }+}++Quill.register("formats/lists", BetterList);++const quillModules = (isSimple) => ({toolbar: [- [{ header: [false, 1, 2, 3, 4, 5, 6] }],+ //["bold", "italic", "underline", "strike", "blockquote"],+ [{ header: "2" }, { header: "3" }, { header: [false, 4, 5, 6] }],[{ align: "" },{ align: "center" },@@ -22,6 +41,7 @@ const quillModules = {[{ list: "ordered" },{ list: "bullet" },+ { list: "check" },{ indent: "-1" },{ indent: "+1" },],@@ -35,26 +55,7 @@ const quillModules = {markdownShortcuts: {},magicUrl: true,history: { maxStack: 1000 * 5 },-};--const simpleQuillModules = {- toolbar: [- ["bold", "italic", "underline", "strike", "blockquote"],- [- { list: "ordered" },- { list: "bullet" },- { indent: "-1" },- { indent: "+1" },- ],- [- { align: "" },- { align: "center" },- { align: "right" },- { align: "justify" },- ],- [{ direction: "rtl" }, "clean"],- ],-};+});export default class ReactQuill extends Component {/**@@ -90,7 +91,7 @@ export default class ReactQuill extends Component {placeholder,bounds: container,scrollingContainer: scrollContainer,- modules: modules || (isSimple ? simpleQuillModules : quillModules),+ modules: modules || quillModules(isSimple),theme: "snow",readOnly,});@@ -137,6 +138,7 @@ export default class ReactQuill extends Component {render() {return (<Text+ mx={[2, 2, 0]}as="pre"sx={{ cursor: "text" }}onClick={() => {diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.jsindex 6be6c68c4..c1dced918 100644--- a/apps/web/src/components/editor/titlebox.js+++ b/apps/web/src/components/editor/titlebox.js@@ -7,26 +7,27 @@ var changeTimeout;function TitleBox(props) {const { title, setTitle, changeInterval, shouldFocus } = props;- const [height, setHeight] = useState("auto");+ const [height, setHeight] = useState(60);const inputRef = useRef();const resize = useCallback(() => {const textarea = document.querySelector(".editorTitle");const dummy = document.querySelector(".dummyEditorTitle");dummy.innerHTML = textarea.value;- setHeight(dummy.scrollHeight || 60);+ setHeight(dummy.scrollHeight > 60 ? dummy.scrollHeight : 60);}, []);useEffect(() => {if (!window.ResizeObserver) return;const myObserver = new ResizeObserver((entries) => {const newHeight = entries[0].contentRect.height;- setHeight(newHeight);+ setHeight(newHeight > 60 ? newHeight : 60);});myObserver.observe(document.querySelector(".dummyEditorTitle"));}, []);useEffect(() => {+ console.log("title changged", title);if (!inputRef.current) return;clearTimeout(changeTimeout);inputRef.current.value = title;diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex cde11d468..3fc6f26a4 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -120,6 +120,7 @@ class EditorStore extends BaseStore {this.set((state) => {state.session.id = id;+ state.session.title = db.notes.note(id).title;state.session.isSaving = false;});diff --git a/apps/web/yarn.lock b/apps/web/yarn.lockindex 21caa19ce..8479fdc07 100644--- a/apps/web/yarn.lock+++ b/apps/web/yarn.lock@@ -10643,6 +10643,10 @@ quill-magic-url@^1.0.3:normalize-url "^3.0.1"quill-delta "^3.6.2"+"quill-task-list@https://github.com/CJEnright/quill-task-list":+ version "0.0.0"+ resolved "https://github.com/CJEnright/quill-task-list#5a850aebb4bdc134715ad81ee42ffd5d49f5eef3"+"quill@https://github.com/thecodrr/quill.git#1.3.7":version "1.3.7"resolved "https://github.com/thecodrr/quill.git#adbb4f12348764ceca69deaf3c507d8601fdea6e"