@social-mail/social-mail-client 1.2.18 → 1.2.19

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": "@social-mail/social-mail-client",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -58,6 +58,7 @@ import { List } from "../blocks/List";
58
58
  grid-column: 3;
59
59
  border-left: solid 1px lightgray;
60
60
  border-radius: 0;
61
+ overflow: auto;
61
62
  }
62
63
 
63
64
  & > [data-element=editor] {
@@ -221,6 +222,25 @@ export default class HtmlPageEditor extends AtomControl {
221
222
  this.hover.update(target);
222
223
  }, { capture: true });
223
224
 
225
+ this.htmlDocument.addEventListener("keydown", (e) => {
226
+ if(e.ctrlKey || e.metaKey) {
227
+ switch(e.key) {
228
+ case "s":
229
+ this.contentEditor.dispatchEvent(new CustomEvent("savePage", { bubbles: true }));
230
+ e.preventDefault();
231
+ break;
232
+ case "z":
233
+ this.contentEditor.dispatchEvent(new CustomEvent("undo", { bubbles: true }));
234
+ e.preventDefault();
235
+ break;
236
+ case "y":
237
+ this.contentEditor.dispatchEvent(new CustomEvent("redo", { bubbles: true }));
238
+ e.preventDefault();
239
+ break;
240
+ }
241
+ }
242
+ });
243
+
224
244
  InstallDragDropHelper(this);
225
245
 
226
246
  this.htmlDocument.close();
@@ -405,6 +425,22 @@ export default class HtmlPageEditor extends AtomControl {
405
425
  return this.insertImage(prompt("Image Src", ""));
406
426
  }
407
427
 
428
+ @Action({ onEvent: "keyup"})
429
+ onKeyUp(d, ke: KeyboardEvent) {
430
+ if (ke.ctrlKey) {
431
+ switch(ke.key) {
432
+ case "z":
433
+ ke.preventDefault();
434
+ this.undo();
435
+ break;
436
+ case "y":
437
+ ke.preventDefault();
438
+ this.redo();
439
+ break;
440
+ }
441
+ }
442
+ }
443
+
408
444
  async insertImage(src: string, style?: { [key: string]: string}) {
409
445
  let img: HTMLImageElement;
410
446
  if(this.selection.isImage) {
@@ -486,6 +522,18 @@ export default class HtmlPageEditor extends AtomControl {
486
522
  }, 100);
487
523
  }
488
524
 
525
+ @Action({ onEvent: "undo"})
526
+ undo() {
527
+ this.redoList.insert(this.redoList.length, this.htmlDocument.documentElement.innerHTML);
528
+ this.htmlDocument.documentElement.innerHTML = this.undoList.removeAt(this.undoList.length-1);
529
+ }
530
+
531
+ @Action({ onEvent: "redo"})
532
+ redo() {
533
+ this.undoList.insert(this.undoList.length, this.htmlDocument.documentElement.innerHTML);
534
+ this.htmlDocument.documentElement.innerHTML = this.redoList.removeAt(this.redoList.length-1);
535
+ }
536
+
489
537
  protected async setStylerSheet() {
490
538
  const document = this.htmlDocument;
491
539
  let style = document.querySelector(`[styler-style-sheet]`);
@@ -26,26 +26,56 @@ export const BindStyleCustom = AtomControl.registerProperty("data-style-property
26
26
  styled.css `
27
27
 
28
28
  display: grid;
29
- grid-template-columns: auto 1fr;
30
- grid-template-rows: auto auto;
29
+ grid-template-columns: 1fr;
30
+ grid-template-rows: auto auto auto;
31
+ justify-items: stretch;
32
+ align-items: center;
31
33
  column-gap: 5px;
34
+ max-width: 200px;
35
+ & > * {
36
+ width: 100%;
37
+ }
32
38
  & > label {
33
39
  grid-row: 1;
34
40
  grid-column: 1;
35
41
  }
36
42
 
37
43
  & > [data-element=editor] {
38
- grid-row: 1;
39
- grid-column: 2;
44
+ grid-row: 2;
45
+ grid-column: 1;
40
46
  }
41
47
 
42
48
  & > [data-element=custom] {
43
- grid-row: 2;
44
- grid-column: 1 / span 2;
49
+ grid-row: 3;
50
+ grid-column: 1;
51
+ }
52
+
53
+ & select {
54
+ outline: none;
55
+ border: none;
56
+ background-color: #e7e7e775;
57
+ border-radius: 9999px;
58
+ padding-left: 10px;
59
+ padding-right: 10px;
45
60
  }
46
61
 
47
62
  `.installGlobal("[data-element=property-editor]");
48
63
 
64
+
65
+ styled.css `
66
+
67
+ & select {
68
+ outline: none;
69
+ border: none;
70
+ background-color: #e7e7e775;
71
+ border-radius: 9999px;
72
+ padding-left: 10px;
73
+ padding-right: 10px;
74
+ }
75
+
76
+
77
+ `.installGlobal("[data-element=expander-property-editor]")
78
+
49
79
  function PropertyEditor({ label = void 0, custom = void 0, ... a }, ... nodes: XNode[]) {
50
80
  if (!label && nodes.length === 1) {
51
81
  return nodes[0];
@@ -70,7 +100,9 @@ export function ExpanderPropertyEditor({
70
100
  const child = nodes.length > 1
71
101
  ? <div data-layout="vertical-flex-stretch-items">{ ... nodes }</div>
72
102
  : nodes[0];
73
- return <Expander isExpanded={isExpanded}
103
+ return <Expander
104
+ data-element="expander-property-editor"
105
+ isExpanded={isExpanded}
74
106
  { ... a}>
75
107
  { label && <label>{label}</label>}
76
108
  { child }
@@ -112,16 +112,16 @@ export const stylerVars = prepareVariables({
112
112
 
113
113
  secondaryBackground: "#00808050",
114
114
  secondaryColor: "gray",
115
- secondaryAccent: "blue",
115
+ secondaryAccent: "#318984a8",
116
116
  secondaryAccentText: "white",
117
- secondarySurface: "#00A0A080",
117
+ secondarySurface: "#FFFFFFA0",
118
118
  secondarySurfaceText: "gray",
119
119
 
120
- tertiaryBackground: "#7b4fc596",
120
+ tertiaryBackground: "#cfa55c87",
121
121
  tertiaryColor: "gray",
122
- tertiaryAccent: "blue",
122
+ tertiaryAccent: "#e17b42cf",
123
123
  tertiaryAccentText: "white",
124
- tertiarySurface: "#0000A080",
124
+ tertiarySurface: "#FFFFFFA0",
125
125
  tertiarySurfaceText: "gray",
126
126
  });
127
127
 
@@ -8,18 +8,12 @@ export default function UndoRedoToolbar() {
8
8
  return <EditorToolbar
9
9
  data-element="undo">
10
10
  <i
11
- event-click={EditorCommand.onClick((editor) => {
12
- editor.redoList.insert(editor.redoList.length, editor.htmlDocument.documentElement.innerHTML);
13
- editor.htmlDocument.documentElement.innerHTML = editor.undoList.removeAt(editor.undoList.length-1);
14
- })}
11
+ data-click-event="undo"
15
12
  title="Undo"
16
13
  data-disabled={Bind.oneWay((editor: HtmlPageEditor) => editor.undoList.length === 0)}
17
14
  class="fas fa-undo" />
18
15
  <i
19
- event-click={EditorCommand.onClick((editor) => {
20
- editor.undoList.insert(editor.undoList.length, editor.htmlDocument.documentElement.innerHTML);
21
- editor.htmlDocument.documentElement.innerHTML = editor.redoList.removeAt(editor.redoList.length-1);
22
- })}
16
+ data-click-event="redo"
23
17
  title="Redo"
24
18
  data-disabled={Bind.oneWay((editor: HtmlPageEditor) => editor.redoList.length === 0)}
25
19
  class="fas fa-redo" />