@websline/cms-view-utils 1.0.2 → 1.0.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websline/cms-view-utils",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -40,7 +40,9 @@
40
40
  return debounced;
41
41
  };
42
42
 
43
- const handleClick = (action) => {
43
+ const handleClick = (event, action) => {
44
+ event.stopPropagation();
45
+
44
46
  switch (action) {
45
47
  case CMS_ACTIONS.add:
46
48
  notifyCMS(EVENTS.BLOCK_ADD, { position });
@@ -132,23 +134,26 @@
132
134
  data-cms-editable-block
133
135
  onmouseenter={handleEnterDebounced}
134
136
  onmouseleave={handleLeave}
135
- role="group">
137
+ onclick={(event) => handleClick(event, CMS_ACTIONS.edit)}
138
+ onkeydown={(event) => event.key === "Enter" && handleClick(event, CMS_ACTIONS.edit)}
139
+ role="button"
140
+ tabindex="0">
136
141
  <div
137
- class="pointer-events-none absolute inset-0 z-[9998] border-6 transition-opacity duration-100"
142
+ class="pointer-events-none absolute inset-0 z-9998 border-6 transition-opacity duration-100"
138
143
  style="border-color: var(--block-color)"
139
144
  class:opacity-100={toolbarVisible}
140
145
  class:opacity-0={!toolbarVisible}>
141
146
  </div>
142
147
 
143
148
  <div
144
- class="absolute left-1/2 z-[9999] flex h-9 -translate-x-1/2 items-center justify-center gap-1.5 px-3 transition-opacity duration-100 before:absolute before:h-4 before:w-4 before:rounded-full before:bg-transparent before:content-[''] after:absolute after:h-4 after:w-4 after:rounded-full after:bg-transparent after:content-[''] {containerShape} {cornerEdges}"
149
+ class="absolute left-1/2 z-9999 flex h-9 -translate-x-1/2 items-center justify-center gap-1.5 px-3 transition-opacity duration-100 before:absolute before:h-4 before:w-4 before:rounded-full before:bg-transparent before:content-[''] after:absolute after:h-4 after:w-4 after:rounded-full after:bg-transparent after:content-[''] {containerShape} {cornerEdges}"
145
150
  style="background: var(--block-color); color: var(--block-text);"
146
151
  class:opacity-100={toolbarVisible}
147
152
  class:opacity-0={!toolbarVisible}>
148
153
  <button
149
154
  aria-label="add block"
150
155
  class="cursor-pointer"
151
- onclick={() => handleClick(CMS_ACTIONS.add)}>
156
+ onclick={(event) => handleClick(event, CMS_ACTIONS.add)}>
152
157
  <svg
153
158
  width="24"
154
159
  height="24"
@@ -168,7 +173,7 @@
168
173
  <button
169
174
  aria-label="hide block"
170
175
  class="cursor-pointer"
171
- onclick={() => handleClick(CMS_ACTIONS.hideBlock)}>
176
+ onclick={(event) => handleClick(event, CMS_ACTIONS.hideBlock)}>
172
177
  <svg
173
178
  width="24"
174
179
  height="24"
@@ -193,7 +198,7 @@
193
198
  <button
194
199
  aria-label="show block"
195
200
  class="cursor-pointer"
196
- onclick={() => handleClick(CMS_ACTIONS.showBlock)}>
201
+ onclick={(event) => handleClick(event, CMS_ACTIONS.showBlock)}>
197
202
  <svg
198
203
  width="24"
199
204
  height="24"
@@ -222,7 +227,7 @@
222
227
  <!-- <button
223
228
  aria-label="copy block"
224
229
  class="cursor-pointer"
225
- onclick={() => handleClick(CMS_ACTIONS.copy)}>
230
+ onclick={(event) => handleClick(event, CMS_ACTIONS.copy)}>
226
231
  <svg
227
232
  width="24"
228
233
  height="24"
@@ -241,7 +246,7 @@
241
246
  <button
242
247
  aria-label="position block"
243
248
  class="cursor-pointer"
244
- onclick={() => handleClick(CMS_ACTIONS.position)}>
249
+ onclick={(event) => handleClick(event, CMS_ACTIONS.position)}>
245
250
  <svg
246
251
  width="24"
247
252
  height="24"
@@ -260,7 +265,7 @@
260
265
  <button
261
266
  aria-label="delete block"
262
267
  class="cursor-pointer"
263
- onclick={() => handleClick(CMS_ACTIONS.delete)}>
268
+ onclick={(event) => handleClick(event, CMS_ACTIONS.delete)}>
264
269
  <svg
265
270
  width="24"
266
271
  height="24"
@@ -279,7 +284,7 @@
279
284
  <button
280
285
  aria-label="edit block"
281
286
  class="cursor-pointer"
282
- onclick={() => handleClick(CMS_ACTIONS.edit)}>
287
+ onclick={(event) => handleClick(event, CMS_ACTIONS.edit)}>
283
288
  <svg
284
289
  width="24"
285
290
  height="24"