@exmg/exm-markdown-editor 1.1.8 → 1.1.10-alpha.35

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/dist/actions.js CHANGED
@@ -9,15 +9,15 @@ export const toolbarActions = [
9
9
  },
10
10
  {
11
11
  name: 'header_one',
12
- icon: 'headerone',
12
+ icon: 'format_h1',
13
13
  },
14
14
  {
15
15
  name: 'header_two',
16
- icon: 'headertwo',
16
+ icon: 'format_h2',
17
17
  },
18
18
  {
19
19
  name: 'header_three',
20
- icon: 'headerthree',
20
+ icon: 'format_h3',
21
21
  },
22
22
  {
23
23
  name: 'unordered_list',
@@ -57,7 +57,7 @@ export const toolbarActions = [
57
57
  },
58
58
  {
59
59
  name: 'hr',
60
- icon: 'hr',
60
+ icon: 'horizontal_rule',
61
61
  },
62
62
  {
63
63
  name: 'table',
@@ -48,9 +48,14 @@ export declare class MarkdownEditorElementBase extends MarkdownBaseClass {
48
48
  toolbarIcons?: ToolbarIcons;
49
49
  markedExtension?: TokenizerAndRendererExtension[];
50
50
  required: boolean;
51
+ disabled: boolean;
52
+ supportingText: string;
53
+ splitView: boolean;
54
+ fullScreen: boolean;
51
55
  editorElement?: HTMLDivElement;
56
+ editorContainerElement?: HTMLDivElement;
52
57
  previewElement?: Element | null;
53
- height: number;
58
+ isFullScreen?: boolean;
54
59
  preview: boolean;
55
60
  editorConfiguration: EditorConfiguration;
56
61
  editorActions: MarkdownActions;
@@ -69,13 +74,16 @@ export declare class MarkdownEditorElementBase extends MarkdownBaseClass {
69
74
  protected firstUpdated(): void;
70
75
  protected disconectedCallback(): void;
71
76
  protected getPreviewElement(): Element | null;
77
+ private handleEditorScroll;
78
+ private toggleFullscreen;
79
+ private handleExitFullScreen;
72
80
  codeMirrorSetup(): void;
73
81
  handleFocus(): void;
74
82
  handleBlur(): void;
75
83
  handleAction(e: CustomEvent): void;
76
84
  handleInsertImage(url: string): void;
77
85
  updateValue(newValue?: string): void;
78
- disablePreview(): void;
86
+ private handleContainerClick;
79
87
  protected render(): import("lit-html").TemplateResult<1>;
80
88
  }
81
89
  export {};
@@ -1,6 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { html, nothing } from 'lit';
3
- import { styleMap } from 'lit/directives/style-map.js';
4
3
  import { query, property, state } from 'lit/decorators.js';
5
4
  import { defaultConfiguration } from './utils/configurations.js';
6
5
  import { ExmgElement, observer } from '@exmg/lit-base';
@@ -12,6 +11,7 @@ import { toolbarIcons } from './icons.js';
12
11
  import { MardownEditorValidator } from './validator/exm-markdown-editor-validator.js';
13
12
  import { createValidator, getValidityAnchor, mixinConstraintValidation, } from '@material/web/labs/behaviors/constraint-validation.js';
14
13
  import './exm-markdown-editor-toolbar.js';
14
+ import { classMap } from 'lit/directives/class-map.js';
15
15
  const MarkdownBaseClass = mixinConstraintValidation(mixinFormAssociated(mixinElementInternals(ExmgElement)));
16
16
  /**
17
17
  * Markdown editor element.
@@ -53,7 +53,11 @@ export class MarkdownEditorElementBase extends MarkdownBaseClass {
53
53
  this.toolbarActions = toolbarActions;
54
54
  this.toolbarIcons = toolbarIcons;
55
55
  this.required = false;
56
- this.height = 400;
56
+ this.disabled = false;
57
+ this.supportingText = '';
58
+ this.splitView = false;
59
+ this.fullScreen = false;
60
+ this.isFullScreen = false;
57
61
  this.preview = true;
58
62
  this.editorConfiguration = defaultConfiguration;
59
63
  this.editorActions = markdownActions;
@@ -89,15 +93,14 @@ export class MarkdownEditorElementBase extends MarkdownBaseClass {
89
93
  }
90
94
  firstUpdated() {
91
95
  var _a;
92
- this.codeMirrorSetup();
96
+ if (!this.disabled) {
97
+ this.codeMirrorSetup();
98
+ }
93
99
  this.previewElement = this.getPreviewElement();
94
100
  /* Height */
95
101
  if (this.previewElement.hasAttribute('slot')) {
96
102
  (_a = this.shadowRoot.querySelector('#preview')) === null || _a === void 0 ? void 0 : _a.remove();
97
- this.previewElement.setAttribute('style', `height: ${this.height}px;`);
98
103
  }
99
- this.heightStyleMap = styleMap({ height: `${this.height}px` });
100
- this.codeMirrorEditor.getWrapperElement().style.height = `${this.height}px`;
101
104
  /** Blur global handling */
102
105
  this.blurHandlerBinding = this.handleBlur.bind(this);
103
106
  this.addEventListener('blur', this.handleBlur);
@@ -116,6 +119,49 @@ export class MarkdownEditorElementBase extends MarkdownBaseClass {
116
119
  getPreviewElement() {
117
120
  return this.shadowRoot.querySelector('#preview');
118
121
  }
122
+ // CodeMirror types is not handling the scroll event type correct
123
+ handleEditorScroll(event) {
124
+ const previewContainer = this.renderRoot.querySelector('.preview');
125
+ const previewArea = this.renderRoot.querySelector('.preview-content');
126
+ if (!previewArea || !previewContainer || (!this.splitView && !this.isFullScreen)) {
127
+ return;
128
+ }
129
+ // DOMRectList of CodeMirrors scroll area
130
+ const scroller = event.display.scroller.getClientRects()[0];
131
+ // DOMRectList of CodeMirrors editor/content area
132
+ const sizer = event.display.sizer.getClientRects()[0];
133
+ // DOMRectList of previewArea
134
+ const preview = previewArea.getClientRects()[0];
135
+ // Get the total distance scroller in the editor
136
+ const scrolledDistance = scroller.y - sizer.y;
137
+ // Get the maximal scroll distance for the editor
138
+ const maxEditorScrollDistance = sizer.height - scroller.height;
139
+ // Get the maximal scroll distance for the preview
140
+ const maxPreviewScrollDistance = preview.height - scroller.height;
141
+ // Calculate the scroll progress bases on the above values
142
+ const scrollProgress = Math.min(scrolledDistance / maxEditorScrollDistance, 1);
143
+ previewContainer.scrollTo({
144
+ top: maxPreviewScrollDistance * scrollProgress,
145
+ });
146
+ }
147
+ toggleFullscreen() {
148
+ if (!this.editorContainerElement) {
149
+ return;
150
+ }
151
+ this.isFullScreen = !this.isFullScreen;
152
+ if (!document.fullscreenElement) {
153
+ this.editorContainerElement.requestFullscreen();
154
+ document.addEventListener('fullscreenchange', this.handleExitFullScreen.bind(this));
155
+ }
156
+ else {
157
+ document.exitFullscreen();
158
+ }
159
+ }
160
+ handleExitFullScreen() {
161
+ if (!document.fullscreenElement) {
162
+ this.isFullScreen = false;
163
+ }
164
+ }
119
165
  codeMirrorSetup() {
120
166
  if (!this.editorElement) {
121
167
  console.log('Error');
@@ -129,12 +175,13 @@ export class MarkdownEditorElementBase extends MarkdownBaseClass {
129
175
  ...this.editorConfiguration,
130
176
  value: this.value || '',
131
177
  });
132
- this.codeMirrorEditor.on('focus', (_editor) => {
178
+ this.codeMirrorEditor.on('focus', (_) => {
133
179
  this.handleFocus();
134
180
  });
135
181
  this.codeMirrorEditor.on('change', (editor) => {
136
182
  this.updateValue(editor.getValue());
137
183
  });
184
+ this.codeMirrorEditor.on('scroll', this.handleEditorScroll.bind(this));
138
185
  this.internalTextarea = this.codeMirrorEditor.getInputField();
139
186
  }
140
187
  handleFocus() {
@@ -176,33 +223,53 @@ export class MarkdownEditorElementBase extends MarkdownBaseClass {
176
223
  this.value = newValue || '';
177
224
  this.fire('change', this.value);
178
225
  }
179
- disablePreview() {
180
- this.preview = false;
226
+ handleContainerClick() {
227
+ if (!this.disabled) {
228
+ this.preview = false;
229
+ }
181
230
  }
182
231
  render() {
232
+ const containerClasses = {
233
+ 'has-label': !!this.label,
234
+ 'preview-mode': this.preview,
235
+ 'split-view': (this.splitView || !!this.isFullScreen) && !this.disabled,
236
+ 'full-screen': this.fullScreen,
237
+ };
238
+ const labelClasses = { 'not-empty': !!this.value, 'preview-mode': this.preview };
183
239
  return html `
184
240
  <div
185
- id="markdowdEditorContainer"
186
- class="container"
187
- @click=${this.disablePreview}
188
- style=${this.heightStyleMap}
189
- ?label=${this.label}
190
- ?preview=${this.preview}
241
+ id="markdownEditorContainer"
242
+ class="container ${classMap(containerClasses)}"
243
+ @click=${this.handleContainerClick}
191
244
  >
245
+ <div class="background"></div>
246
+ <div class="state-layer"></div>
192
247
  ${this.label
193
- ? html `<label ?preview=${this.preview} for="markdowdEditorContainer">${this.label}</label>`
248
+ ? html `<label class="${classMap(labelClasses)}" for="markdownEditorContainer">${this.label}</label>`
194
249
  : nothing}
195
250
  <exm-markdown-editor-toolbar
196
- ?label=${this.label}
197
- ?preview=${this.preview}
198
251
  ?upload=${this.upload}
199
252
  @action=${this.handleAction}
200
253
  .actions=${this.toolbarActions || []}
201
254
  .icons=${this.toolbarIcons || []}
202
255
  ></exm-markdown-editor-toolbar>
203
- <div id="editor" ?preview=${this.preview} style=${this.heightStyleMap}></div>
204
- <div id="preview" ?preview=${this.preview} style=${this.heightStyleMap}></div>
205
- <slot name="preview" ?preview=${this.preview}></slot>
256
+ <section class="label-bar">
257
+ <span>Editor</span>
258
+ <span>Preview</span>
259
+ </section>
260
+ <div class="editor" id="editor" @scroll=${(evt) => console.log(evt)}></div>
261
+ <div id="preview" class="preview"></div>
262
+ ${this.fullScreen
263
+ ? html `
264
+ <section class="full-screen-button">
265
+ <md-icon-button @click=${this.toggleFullscreen} title="Toggle for a full screen editor mode"
266
+ ><md-icon>${this.isFullScreen ? 'fullscreen_exit' : 'fullscreen'}</md-icon></md-icon-button
267
+ >
268
+ </section>
269
+ `
270
+ : nothing}
271
+ <slot name="preview"></slot>
272
+ ${this.supportingText ? html `<div class="supporting-text">${this.supportingText}</div>` : nothing}
206
273
  </div>
207
274
  `;
208
275
  }
@@ -231,15 +298,30 @@ __decorate([
231
298
  __decorate([
232
299
  property({ type: Boolean, reflect: true })
233
300
  ], MarkdownEditorElementBase.prototype, "required", void 0);
301
+ __decorate([
302
+ property({ type: Boolean, reflect: true })
303
+ ], MarkdownEditorElementBase.prototype, "disabled", void 0);
304
+ __decorate([
305
+ property({ type: String, attribute: 'supporting-text' })
306
+ ], MarkdownEditorElementBase.prototype, "supportingText", void 0);
307
+ __decorate([
308
+ property({ type: Boolean, attribute: 'split-view' })
309
+ ], MarkdownEditorElementBase.prototype, "splitView", void 0);
310
+ __decorate([
311
+ property({ type: Boolean, attribute: 'full-screen' })
312
+ ], MarkdownEditorElementBase.prototype, "fullScreen", void 0);
234
313
  __decorate([
235
314
  query('#editor')
236
315
  ], MarkdownEditorElementBase.prototype, "editorElement", void 0);
316
+ __decorate([
317
+ query('#markdownEditorContainer')
318
+ ], MarkdownEditorElementBase.prototype, "editorContainerElement", void 0);
237
319
  __decorate([
238
320
  state()
239
321
  ], MarkdownEditorElementBase.prototype, "previewElement", void 0);
240
322
  __decorate([
241
- property({ type: Number })
242
- ], MarkdownEditorElementBase.prototype, "height", void 0);
323
+ state()
324
+ ], MarkdownEditorElementBase.prototype, "isFullScreen", void 0);
243
325
  __decorate([
244
326
  state(),
245
327
  observer(function (preview) {
package/dist/icons.d.ts CHANGED
@@ -1,6 +1,3 @@
1
1
  export declare const toolbarIcons: {
2
- headerone: import("lit-html").TemplateResult<1>;
3
- headertwo: import("lit-html").TemplateResult<1>;
4
- headerthree: import("lit-html").TemplateResult<1>;
5
- hr: import("lit-html").TemplateResult<1>;
2
+ example_icon: import("lit-html").TemplateResult<1>;
6
3
  };
package/dist/icons.js CHANGED
@@ -1,28 +1,5 @@
1
1
  import { html } from 'lit';
2
2
  export const toolbarIcons = {
3
- headerone: html `<svg>
4
- <g id="header-one">
5
- <path
6
- d="M11.5 13H5v5a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 3 0v5h6.5V5a1.5 1.5 0 0 1 3 0v13a1.5 1.5 0 0 1-3 0v-5zm8.5 6h-1.2v-6.535l-1.8.627v-1.046L19.82 11H20v8z"
7
- />
8
- </g>
9
- </svg>`,
10
- headertwo: html `<svg>
11
- <g id="header-two">
12
- <path
13
- d="M11.5 13H5v5a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 3 0v5h6.5V5a1.5 1.5 0 0 1 3 0v13a1.5 1.5 0 0 1-3 0v-5zm7.142 4.948H22V19h-4.87v-.917l2.353-2.8c.203-.234.367-.45.497-.634a3.77 3.77 0 0 0 .316-.51c.079-.154.13-.296.163-.431a1.762 1.762 0 0 0-.028-.898 1.244 1.244 0 0 0-.209-.4.967.967 0 0 0-.333-.265 1.057 1.057 0 0 0-.457-.093c-.203 0-.39.037-.541.111a1.074 1.074 0 0 0-.384.302c-.096.129-.175.283-.226.461a2.298 2.298 0 0 0-.073.536H17c.006-.327.056-.634.158-.924.107-.307.265-.572.474-.8a2.14 2.14 0 0 1 .768-.541A2.66 2.66 0 0 1 19.444 11c.36 0 .682.05.97.148.277.104.52.246.711.437.192.184.339.412.44.683.102.27.153.572.153.898 0 .24-.034.486-.107.726-.074.24-.175.48-.305.72s-.282.48-.463.72c-.18.24-.372.486-.587.726l-1.614 1.89z"
14
- />
15
- </g>
16
- </svg>`,
17
- headerthree: html `<svg>
18
- <g id="header-three">
19
- <path
20
- d="M11.5 13H5v5a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 3 0v5h6.5V5a1.5 1.5 0 0 1 3 0v13a1.5 1.5 0 0 1-3 0v-5zm9.815 2.217c.165.125.292.269.393.427.102.164.171.335.222.499.045.184.07.374.07.565 0 .361-.063.69-.19.972a1.997 1.997 0 0 1-.533.722 2.185 2.185 0 0 1-.8.447c-.31.098-.64.151-1.002.151-.33 0-.641-.046-.94-.138a2.334 2.334 0 0 1-.786-.414 1.982 1.982 0 0 1-.546-.69 2.158 2.158 0 0 1-.203-.952h1.263c0 .171.031.329.089.473.057.145.14.263.247.368.108.105.235.184.387.236a1.4 1.4 0 0 0 .508.086c.387 0 .698-.105.92-.322.222-.217.336-.525.336-.933a1.55 1.55 0 0 0-.102-.571 1 1 0 0 0-.279-.4 1.174 1.174 0 0 0-.438-.23 2.212 2.212 0 0 0-.577-.073h-.749V14.41h.743c.215 0 .406-.026.564-.086.16-.059.292-.137.4-.243a.966.966 0 0 0 .241-.374c.051-.144.076-.309.076-.486 0-.374-.088-.663-.279-.867-.19-.204-.476-.309-.863-.309-.171 0-.323.027-.463.08-.14.052-.26.124-.368.216a.998.998 0 0 0-.241.341 1.127 1.127 0 0 0-.089.454H17.07c0-.302.057-.591.184-.848.114-.262.285-.486.495-.676.21-.19.463-.342.761-.453.292-.105.616-.158.965-.158.355 0 .685.046.97.131.299.092.552.237.762.42.216.191.38.421.495.697.12.276.177.598.177.959 0 .158-.019.322-.07.48-.044.164-.12.315-.215.466a2.005 2.005 0 0 1-.87.748c.235.086.432.191.59.316z"
21
- />
22
- </g>
23
- </svg>`,
24
- hr: html `<svg>
25
- <g id="trending-flat"><path d="M22 14h18v-2H3v2z"></path></g>
26
- </svg>`,
3
+ example_icon: html `Some svg here`,
27
4
  };
28
5
  //# sourceMappingURL=icons.js.map
@@ -5,139 +5,206 @@ export const style = css `
5
5
  overflow: hidden;
6
6
  --editor-border-color: var(--exm-markdown-editor-border-color, var(--md-sys-color-on-surface-variant));
7
7
  --editor-border-color-focus: var(--exm-markdown-editor-border-color-focus, var(--md-sys-color-primary));
8
- --editor-background-color: var(--exm-markdown-editor-background-color, var(--md-sys-color-surface-container-high));
8
+ --editor-background-color: var(
9
+ --exm-markdown-editor-background-color,
10
+ var(--md-sys-color-surface-container-highest)
11
+ );
9
12
  --editor-code-background-color: var(
10
13
  --exm-markdown-editor-code-background-color,
11
- var(--md-sys-color-surface-container-high)
12
- );
13
- --editor-background-focus-color: var(
14
- --exm-markdown-editor-background-focus-color,
15
- var(--md-sys-color-surface-container-high)
14
+ var(--md-sys-color-surface-container-highest)
16
15
  );
16
+ --editor-background-focus-color: var(--exm-markdown-editor-background-focus-color, var(--md-sys-color-on-surface));
17
17
  --editor-code-background-focus-color: var(
18
18
  --exm-markdown-editor-code-background-focus-color,
19
- var(--md-sys-color-surface-container-highest)
19
+ var(--md-sys-color-on-surface)
20
20
  );
21
21
  --editor-label-focus-color: var(--exm-markdown-editor-label-focus-color, var(--md-sys-color-primary));
22
22
  --editor-label-color: var(--exm-markdown-editor-label-color, var(--md-sys-color-on-surface));
23
23
  }
24
24
 
25
25
  .container {
26
+ --label-height: 0px;
27
+
26
28
  display: grid;
27
29
  position: relative;
28
- grid-template-columns: 100%;
29
- grid-template-rows: 0px 56px 1fr;
30
+ grid-template-columns: repeat(2, 1fr);
31
+ grid-template-rows: var(--label-height) auto auto 1fr auto;
30
32
  transition: grid-template-rows 0.2s ease;
31
33
  border-top-right-radius: 4px;
32
- background-color: var(--editor-code-background-color, var(--md-sys-color-surface-container-high));
33
34
  border-top-left-radius: 4px;
35
+ overflow: hidden;
36
+ height: 100%;
34
37
  }
35
38
 
36
- .container[label] {
37
- grid-template-rows: 2rem 56px 1fr;
39
+ .container.has-label {
40
+ --label-height: 2rem;
38
41
  }
39
42
 
40
- .container:hover {
41
- background-color: var(--editor-code-background-focus-color, var(--md-sys-color-surface-container-highest));
43
+ .container.preview-mode:hover .state-layer {
44
+ cursor: text;
42
45
  }
43
46
 
44
- .container::after {
45
- content: ' ';
47
+ .container.split-view .preview,
48
+ .container.preview-mode .preview {
46
49
  display: block;
47
- position: absolute;
48
- bottom: 0;
49
- width: 100%;
50
- height: 3px;
51
- background: var(--editor-border-color-focus, var(--md-sys-color-primary));
52
50
  }
53
51
 
54
- .container[preview] {
55
- background-color: var(--editor-background-color, var(--md-sys-color-surface-container-high));
56
- grid-template-rows: 0px 0.3rem 1fr;
52
+ .container.preview-mode:not(.split-view) .editor {
53
+ display: none;
57
54
  }
58
55
 
59
- .container[preview][label] {
60
- grid-template-rows: 2rem 0.3rem 1fr;
56
+ .container.preview-mode:not(.split-view) exm-markdown-editor-toolbar {
57
+ display: none;
61
58
  }
62
59
 
63
- .container[preview]:hover {
64
- background-color: var(--editor-code-background-focus-color, var(--md-sys-color-surface-container-highest));
65
- cursor: text;
60
+ .container.split-view .preview {
61
+ grid-area: 4/2/5/3;
62
+ border-left: 1px solid var(--md-sys-color-surface-variant);
63
+ background-color: var(--editor-code-background-color, var(--md-sys-color-surface-container-highest));
66
64
  }
67
65
 
68
- .container[preview]::after {
69
- height: 1px;
70
- background: var(--editor-border-color, var(--md-sys-color-on-surface-variant));
66
+ .container.split-view .editor {
67
+ grid-area: 4/1/5/2;
71
68
  }
72
69
 
73
- label[for='markdowdEditorContainer'] {
74
- grid-row-start: 1;
75
- padding: 0.5rem 0 0 1rem;
76
- font-size: 0.7rem;
77
- color: var(--editor-label-focus-color, var(--md-sys-color-primary));
78
- transition: all 200ms ease;
79
- transform: scale(1) translateY(0px);
70
+ .container.split-view .label-bar {
71
+ display: grid;
80
72
  }
81
73
 
82
- label[for='markdowdEditorContainer'][preview] {
83
- color: var(--editor-label-color, var(--md-sys-color-on-surface));
84
- padding-bottom: 1rem;
85
- transform: translateY(8px);
86
- font-size: 1rem;
74
+ .preview {
75
+ grid-area: 2/1/5/3;
76
+ display: none;
77
+ position: relative;
78
+ overflow: scroll;
79
+ }
80
+
81
+ .editor {
82
+ grid-area: 3/1/5/3;
83
+ position: relative;
84
+ overflow: hidden;
85
+ }
86
+
87
+ #editor {
88
+ overflow: hidden;
87
89
  }
88
90
 
89
91
  exm-markdown-editor-toolbar {
90
- grid-row-start: 1;
91
- visibility: visible;
92
- transition:
93
- visibility 0s,
94
- opacity 0.5s linear;
95
- opacity: 1;
92
+ grid-area: 2/1/3/3;
96
93
  }
97
94
 
98
- exm-markdown-editor-toolbar[preview] {
99
- visibility: hidden;
100
- opacity: 0;
95
+ .container.split-view exm-markdown-editor-toolbar {
96
+ padding-right: 4rem;
101
97
  }
102
98
 
103
- exm-markdown-editor-toolbar[label] {
104
- grid-row-start: 2;
99
+ .full-screen-button {
100
+ position: absolute;
101
+ top: calc(var(--label-height) + 0.5rem);
102
+ right: 1rem;
105
103
  }
106
104
 
107
- #preview {
105
+ .container.preview-mode:not(.split-view) .full-screen-button {
108
106
  display: none;
109
- grid-row-start: 3;
110
- overflow: scroll;
111
107
  }
112
108
 
113
- #preview[preview] {
114
- display: block;
109
+ .label-bar {
110
+ display: none;
111
+ grid-template-columns: repeat(2, 1fr);
112
+ grid-area: 3/1/4/3;
113
+ border-bottom: 1px solid var(--md-sys-color-surface-variant);
114
+ background-color: var(--md-sys-color-surface-container);
115
115
  }
116
116
 
117
- #editor {
118
- display: block;
119
- grid-row-start: 3;
117
+ .label-bar span {
118
+ padding: 0.5rem 1rem;
120
119
  }
121
120
 
122
- #editor[preview] {
123
- display: none;
121
+ .label-bar span + span {
122
+ border-left: 1px solid var(--md-sys-color-surface-variant);
124
123
  }
125
124
 
126
- slot[name='preview'] {
127
- display: none;
128
- grid-row-start: 3;
125
+ /* Background and state-layer stuff */
126
+ .background,
127
+ .state-layer {
128
+ grid-area: 1/1/5/3;
129
+ }
130
+
131
+ .background {
132
+ background-color: var(--editor-code-background-color, var(--md-sys-color-surface-container-highest));
133
+ border-bottom: 1px solid var(--editor-border-color-focus, var(--md-sys-color-primary));
134
+ }
135
+
136
+ .container:hover .state-layer {
137
+ background-color: var(--editor-code-background-focus-color, var(--md-sys-color-on-surface-variant));
138
+ opacity: 0.08;
129
139
  }
130
140
 
131
- slot[name='preview'][preview] {
141
+ .background::after {
142
+ content: ' ';
132
143
  display: block;
144
+ position: absolute;
145
+ bottom: 0;
146
+ width: 100%;
147
+ height: 3px;
148
+ }
149
+
150
+ /* The form label style */
151
+ label {
152
+ grid-area: 1/1/2/3;
153
+ }
154
+
155
+ label[for='markdownEditorContainer'],
156
+ label[for='markdownEditorContainer'].not-empty.preview-mode {
157
+ padding: 0.5rem 0 0 1rem;
158
+ font-size: 0.7rem;
159
+ color: var(--editor-label-focus-color, var(--md-sys-color-primary));
160
+ transition: all 200ms ease;
161
+ transform: scale(1) translateY(0px);
162
+ }
163
+
164
+ label[for='markdownEditorContainer'].not-empty.preview-mode {
165
+ color: var(--editor-label-color, var(--md-sys-color-on-surface));
166
+ }
167
+
168
+ label[for='markdownEditorContainer'].preview-mode {
169
+ color: var(--editor-label-color, var(--md-sys-color-on-surface));
170
+ padding-bottom: 1rem;
171
+ transform: translateY(8px);
172
+ font-size: 1rem;
173
+ }
174
+
175
+ /* Supporting text, also know as Description */
176
+ .supporting-text {
177
+ grid-area: 5/1/6/3;
178
+
179
+ color: var(--md-filled-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));
180
+ display: flex;
181
+ font-family: var(
182
+ --md-filled-field-supporting-text-font,
183
+ var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto))
184
+ );
185
+ font-size: var(--md-filled-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));
186
+ line-height: var(
187
+ --md-filled-field-supporting-text-line-height,
188
+ var(--md-sys-typescale-body-small-line-height, 1rem)
189
+ );
190
+ font-weight: var(
191
+ --md-filled-field-supporting-text-weight,
192
+ var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400))
193
+ );
194
+ gap: 16px;
195
+ justify-content: space-between;
196
+ padding-inline-start: var(--md-filled-field-supporting-text-leading-space, 16px);
197
+ padding-inline-end: var(--md-filled-field-supporting-text-trailing-space, 16px);
198
+ padding-top: var(--md-filled-field-supporting-text-top-space, 4px);
133
199
  }
134
200
 
135
- ::slotted([slot='preview']) {
201
+ .CodeMirror {
202
+ height: 100%;
136
203
  overflow: scroll;
137
204
  }
138
205
 
139
206
  .preview-content {
140
- padding: 0 1rem;
207
+ padding: 1rem;
141
208
  }
142
209
  `;
143
210
  //# sourceMappingURL=exm-markdown-editor-css.js.map
@@ -2,11 +2,13 @@ import { css } from 'lit';
2
2
  export const style = css `
3
3
  :host {
4
4
  display: block;
5
+ border-bottom: 1px solid var(--md-sys-color-surface-variant);
5
6
  }
6
7
 
7
8
  .toolbar-container {
8
9
  padding: 0.5rem 1rem;
9
10
  display: flex;
11
+ flex-wrap: wrap;
10
12
  }
11
13
 
12
14
  md-icon-button:not(:first) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exmg/exm-markdown-editor",
3
- "version": "1.1.8",
3
+ "version": "1.1.10-alpha.35+671db4b",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,15 +35,16 @@
35
35
  "**/*.d.ts"
36
36
  ],
37
37
  "dependencies": {
38
- "@exmg/lit-base": "^3.0.0",
38
+ "codemirror": "^5.54.0",
39
+ "marked": "^9.0.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@exmg/lit-base": "^3.0.3",
39
43
  "@material/web": "^2.2.0",
40
- "codemirror": "5.49.2",
41
- "lit": "^3.0.0",
42
- "marked": "^9.0.0",
44
+ "lit": "^3.2.1",
43
45
  "tslib": "^2.6.2"
44
46
  },
45
47
  "devDependencies": {
46
- "@exmg/lit-cli": "^1.1.13",
47
48
  "@types/codemirror": "^0.0.79",
48
49
  "@types/marked": "^1.2.2"
49
50
  },
@@ -51,5 +52,5 @@
51
52
  "publishConfig": {
52
53
  "access": "public"
53
54
  },
54
- "gitHead": "e9c6e6e7b81658423344b640be549700e95be7c0"
55
+ "gitHead": "671db4b2e04ae387cc0eba60fc4419b02036b70b"
55
56
  }