drab 4.1.5 → 4.1.6

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.
@@ -229,28 +229,29 @@ ${repeat}`,
229
229
  });
230
230
  }, 0);
231
231
  }
232
- } else if (e.ctrlKey || e.metaKey) {
233
- if (textArea.selectionStart === textArea.selectionEnd) {
234
- if (e.key === "c" || e.key === "x") {
235
- e.preventDefault();
236
- const { lines, lineNumber, columnNumber } = getLineInfo();
237
- await navigator.clipboard.writeText(
238
- `${lineNumber === 0 && e.key === "x" ? "" : "\n"}${lines[lineNumber]}`
239
- );
240
- if (e.key === "x") {
241
- const newPos = textArea.selectionStart - columnNumber;
242
- lines.splice(lineNumber, 1);
243
- valueTextarea = lines.join("\n");
244
- setTimeout(() => {
245
- textArea.setSelectionRange(newPos, newPos);
246
- }, 0);
247
- }
248
- }
249
- }
250
232
  } else {
251
233
  const nextCharIsClosing = Object.values(keyPairs).includes(nextChar);
252
234
  const highlighted = textArea.selectionStart !== textArea.selectionEnd;
253
- if (e.ctrlKey && e.key) {
235
+ if (e.ctrlKey || e.metaKey) {
236
+ if (textArea.selectionStart === textArea.selectionEnd) {
237
+ if (e.key === "c" || e.key === "x") {
238
+ e.preventDefault();
239
+ const { lines, lineNumber, columnNumber } = getLineInfo();
240
+ await navigator.clipboard.writeText(
241
+ `${lineNumber === 0 && e.key === "x" ? "" : "\n"}${lines[lineNumber]}`
242
+ );
243
+ if (e.key === "x") {
244
+ const newPos = textArea.selectionStart - columnNumber;
245
+ lines.splice(lineNumber, 1);
246
+ valueTextarea = lines.join("\n");
247
+ setTimeout(() => {
248
+ textArea.setSelectionRange(newPos, newPos);
249
+ }, 0);
250
+ }
251
+ }
252
+ }
253
+ }
254
+ if ((e.ctrlKey || e.metaKey) && e.key) {
254
255
  const matchedEl = contentElements.find((el) => el.key === e.key);
255
256
  if (matchedEl)
256
257
  addContent(matchedEl);
@@ -10,7 +10,7 @@ declare const __propDef: {
10
10
  /** controls how the text is added */
11
11
  display: "inline" | "block" | "wrap";
12
12
  /** contents of the `button` */
13
- icon: string | ComponentType;
13
+ icon: string | ComponentType<any>;
14
14
  /** keyboard shortcut */
15
15
  key?: string | undefined;
16
16
  /** class to apply to the specific `button` */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drab",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
4
4
  "description": "An Unstyled Svelte Component Library",
5
5
  "keywords": [
6
6
  "components",