diff --git a/src/app.css b/src/app.css index b5762833..b41a35b2 100644 --- a/src/app.css +++ b/src/app.css @@ -99,27 +99,3 @@ body, [hidden] { display: none; } - -.editor-container { - counter-reset: line; -} - -.editor-container p { - margin-left: 28px !important; - padding-left: 6px !important; - border-left: 1px solid #888; - position: relative; -} - -.editor-container p::before { - counter-increment: line; - content: counter(line); - width: 28px; - padding-right: 6px; - font-size: 12px; - text-align: right; - color: #888; - position: absolute; - left: 0; - transform: translateX(-100%); -} diff --git a/src/lib/components/Editor/Editor.css b/src/lib/components/Editor/Editor.css new file mode 100644 index 00000000..88735c76 --- /dev/null +++ b/src/lib/components/Editor/Editor.css @@ -0,0 +1,39 @@ +.ql-editor { + @apply h-full w-full overflow-y-auto border-none !px-3 !py-2.5 text-base leading-[136%] outline-none; +} + +.ql-editor, +.ql-editor * { + font-family: var(--editor-font-family); + font-size: var(--editor-font-size); +} + +.ql-editor { + scale: var(--editor-zoom); + width: calc(100% / var(--editor-zoom)); + height: calc(100% / var(--editor-zoom)); + transform-origin: top left; +} + +.ql-editor a { + @apply text-blue-500; +} + +@keyframes blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.fake-caret { + animation: blink 1s infinite; + transition: + top 0s, + left 50ms ease-in-out; +} diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor/Editor.svelte similarity index 69% rename from src/lib/components/Editor.svelte rename to src/lib/components/Editor/Editor.svelte index 208e63e8..b536c3ab 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor/Editor.svelte @@ -1,5 +1,5 @@
@@ -115,7 +113,8 @@ bind:this={editorContainer} style="--editor-font-family: '{$settings.fontFamily}'; --editor-font-size: {$settings.fontSize}px; - --editor-zoom: {$settings.zoom};" + --editor-zoom: {$settings.zoom}; + --line-no-digits-count: {lineNo.toString().length}" />
- + -{#if updateScheduled} - -{/if} +{/if} --> - + .ql-editor > *::before { + counter-increment: line; + content: counter(line); + transform: translateX(-100%); + width: clamp(20px, calc(2ch * var(--line-no-digits-count)), 10vw) !important; + padding-right: clamp(10px, calc(0.6ch * var(--line-no-digits-count)), 10vw) !important; + @apply absolute left-0 mt-1 text-right text-xs text-primary duration-300; + } + +{/if} diff --git a/src/lib/components/EditorTabs.svelte b/src/lib/components/EditorTabs.svelte index 04ae3cd5..6bff2a32 100644 --- a/src/lib/components/EditorTabs.svelte +++ b/src/lib/components/EditorTabs.svelte @@ -1,5 +1,5 @@