Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Document editor improvements
Hakan Shehud156df604927
diff --git a/desktop/src/editor/extensions/id.tsx b/desktop/src/editor/extensions/id.tsxindex 76ed69db..6785a41b 100644--- a/desktop/src/editor/extensions/id.tsx+++ b/desktop/src/editor/extensions/id.tsx@@ -1,18 +1,19 @@import { Extension } from '@tiptap/react';import { Plugin, PluginKey } from 'prosemirror-state';import { NeuronId } from '@/lib/id';+import { NodeTypes } from '@/lib/constants';const types = [- 'paragraph',- 'heading',- 'blockquote',- 'bulletList',- 'listItem',- 'orderedList',- 'taskList',- 'taskItem',- 'codeBlock',- 'divider',+ NodeTypes.Paragraph,+ NodeTypes.Heading,+ NodeTypes.Blockquote,+ NodeTypes.BulletList,+ NodeTypes.ListItem,+ NodeTypes.OrderedList,+ NodeTypes.TaskList,+ NodeTypes.TaskItem,+ NodeTypes.CodeBlock,+ NodeTypes.HorizontalRule,];export const IdExtension = Extension.create({@@ -56,7 +57,9 @@ export const IdExtension = Extension.create({if (!node.attrs.id || typeof node.attrs.id !== 'string') {tr.setNodeMarkup(pos, null, {...node.attrs,- id: NeuronId.generate(NeuronId.getIdTypeFromNode(node.type.name)),+ id: NeuronId.generate(+ NeuronId.getIdTypeFromNode(node.type.name),+ ),});}});diff --git a/desktop/src/lib/constants.ts b/desktop/src/lib/constants.tsindex b2c57b2b..4e37e649 100644--- a/desktop/src/lib/constants.ts+++ b/desktop/src/lib/constants.ts@@ -13,14 +13,13 @@ export const NodeTypes = {OrderedList: 'orderedList',TaskList: 'taskList',TaskItem: 'taskItem',- Divider: 'divider',+ HorizontalRule: 'horizontalRule',};export const LeafNodeTypes: string[] = [NodeTypes.Paragraph,NodeTypes.Heading,- NodeTypes.Blockquote,- NodeTypes.Divider,+ NodeTypes.HorizontalRule,NodeTypes.CodeBlock,];diff --git a/desktop/src/styles/editor.css b/desktop/src/styles/editor.cssindex 70a5d652..cad3a41d 100644--- a/desktop/src/styles/editor.css+++ b/desktop/src/styles/editor.css@@ -17,4 +17,59 @@pointer-events: none;height: 0;opacity: 10;-}\ No newline at end of file+}++ul[data-type='taskList'] li > label {+ margin-right: 0.2rem;+ user-select: none;+}++@media screen and (max-width: 768px) {+ ul[data-type='taskList'] li > label {+ margin-right: 0.5rem;+ }+}++ul[data-type='taskList'] li > label input[type='checkbox'] {+ -webkit-appearance: none;+ appearance: none;+ background-color: rgb(255 255 255);+ cursor: pointer;+ width: 1.2em;+ height: 1.2em;+ position: relative;+ top: 5px;+ border: 2px solid rgb(28 25 23);+ margin: 0 0.3rem 0 0;+ display: grid;+ place-content: center;++ &:hover {+ background-color: rgb(250 250 249);+ }++ &:active {+ background-color: rgb(231 229 228);+ }++ &::before {+ content: '';+ width: 0.65em;+ height: 0.65em;+ transform: scale(0);+ transition: 120ms transform ease-in-out;+ box-shadow: inset 1em 1em;+ transform-origin: center;+ clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);+ }++ &:checked::before {+ transform: scale(1);+ }+}++ul[data-type='taskList'] li[data-checked='true'] > div > p {+ color: var(--novel-stone-400);+ text-decoration: line-through;+ text-decoration-thickness: 2px;+}