(https://www.valiantlynx.com/)"
+ ],
+ "engines": {
+ "node": ">=16.14"
+ },
+ "keywords": [
+ "sveltekit",
+ "rich text editor",
+ "javascript",
+ "typescript",
+ "svelte",
+ "blocks"
+ ],
+ "author": "valiantlynx",
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/valiantlynx/svelte-rich-text"
+ },
+ "scripts": {
+ "dev": "vite --host",
+ "build": "vite build",
+ "preview": "vite preview",
+ "package": "svelte-kit sync && svelte-package && publint",
+ "release": "pnpm run package && npx changeset publish",
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
+ "test": "vitest",
+ "lint": "prettier --plugin-search-dir . --check . && eslint .",
+ "format": "prettier --plugin-search-dir . --write ."
+ },
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "svelte": "./dist/index.js"
+ }
+ },
+ "files": [
+ "dist",
+ "!dist/**/*.test.*",
+ "!dist/**/*.spec.*"
+ ],
+ "peerDependencies": {
+ "svelte": "^4.0.0"
+ },
+ "devDependencies": {
+ "@changesets/cli": "^2.26.2",
+ "@sveltejs/adapter-auto": "^2.0.0",
+ "@sveltejs/kit": "^1.20.4",
+ "@sveltejs/package": "^2.0.0",
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
+ "@typescript-eslint/parser": "^6.0.0",
+ "autoprefixer": "^10.4.14",
+ "eslint": "^8.28.0",
+ "eslint-config-prettier": "^8.5.0",
+ "eslint-plugin-svelte": "^2.30.0",
+ "postcss-load-config": "^4.0.1",
+ "prettier": "^2.8.0",
+ "prettier-plugin-svelte": "^2.10.1",
+ "publint": "^0.1.9",
+ "svelte": "^4.0.5",
+ "svelte-check": "^3.4.3",
+ "tslib": "^2.4.1",
+ "typescript": "^5.0.0",
+ "vite": "^4.4.2",
+ "vitest": "^0.34.0"
+ },
+ "svelte": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "type": "module",
+ "typesVersions": {
+ ">4.0": {
+ ".": [
+ "./dist/index.d.ts"
+ ]
+ }
+ },
+ "dependencies": {
+ "altron-rich-text": "^0.0.4",
+ "short-uuid": "^4.2.2",
+ "svelte-highlight": "^7.4.1",
+ "svelte-select": "^5.7.0"
+ }
+}
diff --git a/src/app.d.ts b/src/app.d.ts
new file mode 100644
index 00000000..f59b884c
--- /dev/null
+++ b/src/app.d.ts
@@ -0,0 +1,12 @@
+// See https://kit.svelte.dev/docs/types#app
+// for information about these interfaces
+declare global {
+ namespace App {
+ // interface Error {}
+ // interface Locals {}
+ // interface PageData {}
+ // interface Platform {}
+ }
+}
+
+export {};
diff --git a/src/app.html b/src/app.html
new file mode 100644
index 00000000..d2fc6b06
--- /dev/null
+++ b/src/app.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ %sveltekit.head%
+
+
+ %sveltekit.body%
+
+
diff --git a/src/lib/assets/default.jpg b/src/lib/assets/default.jpg
new file mode 100644
index 00000000..dc3ba221
Binary files /dev/null and b/src/lib/assets/default.jpg differ
diff --git a/src/lib/components/core/blockWrapper.svelte b/src/lib/components/core/blockWrapper.svelte
new file mode 100644
index 00000000..0eb7ad74
--- /dev/null
+++ b/src/lib/components/core/blockWrapper.svelte
@@ -0,0 +1,91 @@
+
+
+
+ {#if dataBlock.name == 'header'}
+
+ {:else if dataBlock.name == 'code'}
+
+ {:else if dataBlock.name == 'image'}
+
+ {:else if dataBlock.name == 'list'}
+
+ {:else if dataBlock.name == 'paragraph'}
+
+ {:else if dataBlock.name == 'quote'}
+
+ {:else}
+
+ {/if}
+
{dataBlock.name}
+
+
+
diff --git a/src/lib/components/core/editMode.svelte b/src/lib/components/core/editMode.svelte
new file mode 100644
index 00000000..ae51a4d9
--- /dev/null
+++ b/src/lib/components/core/editMode.svelte
@@ -0,0 +1,120 @@
+
+
+{#each $data as block}
+
+
+ {#if $workingBlock?.id == block.id && $workingBlock.state == 'focused'}
+
+ {/if}
+
+{/each}
+
+
+
+
diff --git a/src/lib/components/core/main.svelte b/src/lib/components/core/main.svelte
new file mode 100644
index 00000000..3c0f8187
--- /dev/null
+++ b/src/lib/components/core/main.svelte
@@ -0,0 +1,151 @@
+
+
+
+ {#if viewMode}
+
+ {:else}
+
+ {/if}
+
+
+
diff --git a/src/lib/components/core/toolBar.svelte b/src/lib/components/core/toolBar.svelte
new file mode 100644
index 00000000..f4e073c9
--- /dev/null
+++ b/src/lib/components/core/toolBar.svelte
@@ -0,0 +1,145 @@
+
+
+
+
+
diff --git a/src/lib/components/core/viewMode.svelte b/src/lib/components/core/viewMode.svelte
new file mode 100644
index 00000000..b09f4cf2
--- /dev/null
+++ b/src/lib/components/core/viewMode.svelte
@@ -0,0 +1,28 @@
+
+
+{#each $data as block}
+ {#if block.name == 'code'}
+
+ {:else if block.name == 'header'}
+
+ {:else if block.name == 'list'}
+
+ {:else if block.name == 'image'}
+
+ {:else if block.name == 'quote'}
+
+ {:else if block.name == 'paragraph'}
+
+ {:else}
+
+ {/if}
+{/each}
diff --git a/src/lib/components/editBlocks/code.svelte b/src/lib/components/editBlocks/code.svelte
new file mode 100644
index 00000000..16d77e04
--- /dev/null
+++ b/src/lib/components/editBlocks/code.svelte
@@ -0,0 +1,72 @@
+
+
+{#if active}
+
+
+{:else}
+
+{/if}
+
+
diff --git a/src/lib/components/editBlocks/header.svelte b/src/lib/components/editBlocks/header.svelte
new file mode 100644
index 00000000..6d4ab0f0
--- /dev/null
+++ b/src/lib/components/editBlocks/header.svelte
@@ -0,0 +1,68 @@
+
+
+{#if active}
+
+{:else}
+
+{/if}
+
+
diff --git a/src/lib/components/editBlocks/img.svelte b/src/lib/components/editBlocks/img.svelte
new file mode 100644
index 00000000..f214c045
--- /dev/null
+++ b/src/lib/components/editBlocks/img.svelte
@@ -0,0 +1,49 @@
+
+
+{#if active}
+
+ {
+ updateData(id, (el) => {
+ if (el.name == 'image') el.data.caption = text;
+ });
+ }}
+ />
+ {
+ updateData(id, (el) => {
+ if (el.name == 'image') {
+ el.data.name = fileName;
+ el.data.base64 = base64;
+ }
+ });
+ }}
+ />
+
+{:else}
+
+{/if}
+
+
diff --git a/src/lib/components/editBlocks/list.svelte b/src/lib/components/editBlocks/list.svelte
new file mode 100644
index 00000000..76cd6cf2
--- /dev/null
+++ b/src/lib/components/editBlocks/list.svelte
@@ -0,0 +1,105 @@
+
+
+{#if active}
+
+
+{:else}
+
+{/if}
+
+
diff --git a/src/lib/components/editBlocks/paragraph.svelte b/src/lib/components/editBlocks/paragraph.svelte
new file mode 100644
index 00000000..746f21a6
--- /dev/null
+++ b/src/lib/components/editBlocks/paragraph.svelte
@@ -0,0 +1,24 @@
+
+
+{#if active}
+