iconograph-ui 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,6 @@
9
9
  import SexeChoiceInput from "$lib/iconograph-ui/components/form/SexeChoiceInput.svelte";
10
10
  import CustomInput from "$lib/components/CustomInput.svelte";
11
11
  import CustomTable from "../../lib/components/CustomTable.svelte";
12
- import Editor from "$lib/iconograph-ui/components/form/inputs/Editor.svelte";
13
12
  import SegmentedSwitchInput from "$lib/iconograph-ui/components/form/SegmentedSwitchInput.svelte"
14
13
  import Link from "$lib/iconograph-ui/components/display/Link.svelte";
15
14
  import SelectUserInput from "$lib/iconograph-ui/components/user/SelectUserInput.svelte";
@@ -81,7 +80,6 @@
81
80
  </Card>
82
81
 
83
82
  <Card padding={'0px'}>
84
- <Editor bind:content={message} ></Editor>
85
83
  </Card>
86
84
 
87
85
  <Card>
@@ -9,7 +9,6 @@
9
9
  import SexeChoiceInput from "$lib/iconograph-ui/components/form/SexeChoiceInput.svelte";
10
10
  import CustomInput from "$lib/components/CustomInput.svelte";
11
11
  import CustomTable from "../../lib/components/CustomTable.svelte";
12
- import Editor from "$lib/iconograph-ui/components/form/inputs/Editor.svelte";
13
12
  import SegmentedSwitchInput from "$lib/iconograph-ui/components/form/SegmentedSwitchInput.svelte"
14
13
  import Link from "$lib/iconograph-ui/components/display/Link.svelte";
15
14
  import SelectUserInput from "$lib/iconograph-ui/components/user/SelectUserInput.svelte";
@@ -81,7 +80,6 @@
81
80
  </Card>
82
81
 
83
82
  <Card padding={'0px'}>
84
- <Editor bind:content={message} ></Editor>
85
83
  </Card>
86
84
 
87
85
  <Card>
package/index.js CHANGED
@@ -17,7 +17,6 @@ import NavBar from "./lib/components/navigation/NavBar.svelte";
17
17
  import SelectUserInput from "./lib/components/user/SelectUserInput.svelte";
18
18
  import Modal from "./lib/components/layout/Modal.svelte"
19
19
  import FlexForm from "./lib/components/form/FlexForm.svelte";
20
- import Editor from "./lib/components/form/inputs/Editor.svelte";
21
20
  import SegmentedSwitchInput from "./lib/components/form/SegmentedSwitchInput.svelte"
22
21
  import DateStr from "./lib/components/display/DateStr.svelte";
23
22
  import Field from "./lib/components/display/Field.svelte";
@@ -49,7 +48,6 @@ export {
49
48
  NavBar,
50
49
  SelectUserInput,
51
50
  Modal,
52
- Editor,
53
51
  DateStr,
54
52
  Field,
55
53
  Link,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iconograph-ui",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "A Svelte Kit components library",
5
5
  "main": "./index.js",
6
6
  "svelte": "./index.js",
@@ -1,107 +0,0 @@
1
- <script>
2
- import { onMount } from "svelte";
3
- import "quill/dist/quill.snow.css";
4
- import "quill-better-table/dist/quill-better-table.css";
5
-
6
- export let content = "";
7
- export let theme = "snow";
8
- export let width = "100%";
9
- export let height = "200px";
10
-
11
- let editorEl;
12
- let editor;
13
- let isInternalChange = false; // pour éviter les boucles du changement dynamique de content
14
-
15
- const tooltips = {
16
- bold: "Gras",
17
- italic: "Italique",
18
- underline: "Souligné",
19
- strike: "Barré",
20
- link: "Lien",
21
- image: "Image",
22
- blockquote: "Citation",
23
- clean: "Effacer le formatage",
24
- };
25
-
26
- function addTooltips() {
27
- const toolbar = editorEl?.parentElement?.querySelector(".ql-toolbar");
28
- if (!toolbar) return;
29
-
30
- toolbar.querySelectorAll("button, select").forEach((btn) => {
31
- const format =
32
- btn.className.match(/ql-(\w+)/)?.[1] ||
33
- btn.getAttribute("value") ||
34
- null;
35
-
36
- if (format && tooltips[format]) {
37
- btn.setAttribute("title", tooltips[format]);
38
- }
39
- });
40
- }
41
-
42
- onMount(async () => {
43
- const Quill = (await import("quill")).default;
44
- const QuillBetterTable = (await import("quill-better-table")).default;
45
-
46
- Quill.register({ "modules/better-table": QuillBetterTable }, true);
47
-
48
- editor = new Quill(editorEl, {
49
- theme,
50
- modules: {
51
- toolbar: [
52
- [{ header: [1, 2, 3, 4, false] }],
53
- ["bold", "italic", "underline", "strike"],
54
- [{ color: [] }, { background: [] }],
55
- ["blockquote"],
56
- [{ list: "ordered" }, { list: "bullet" }],
57
- [{ align: [] }],
58
- ["link"],
59
- ["clean"],
60
- // ["table"],
61
- ],
62
- table: false, // désactive le module table de base
63
- "better-table": {
64
- operationMenu: {
65
- items: {
66
- unmergeCells: { text: "Unmerge cells" },
67
- },
68
- },
69
- },
70
- },
71
- placeholder: "Rédigez votre message...",
72
- });
73
-
74
- if (content)
75
- editor.clipboard.dangerouslyPasteHTML(content);
76
-
77
- editor.on("text-change", () => {
78
- isInternalChange = true;
79
- content = editor.root.innerHTML;
80
- isInternalChange = false;
81
- });
82
-
83
- addTooltips();
84
- });
85
-
86
- $: if (editor && !isInternalChange) {
87
- const currentHTML = editor.root.innerHTML;
88
- if (content && content !== currentHTML) {
89
- editor.clipboard.dangerouslyPasteHTML(content);
90
- }
91
- }
92
- </script>
93
-
94
- <div
95
- bind:this={editorEl}
96
- style="width: {width}; height: {height};"
97
- ></div>
98
-
99
- <style>
100
- /*.ql-toolbar {
101
- border-radius: 0.5rem 0.5rem 0 0;
102
- }
103
- .ql-container {
104
- border-radius: 0 0 0.5rem 0.5rem;
105
- min-height: 100px;
106
- }*/
107
- </style>