Skip to content

Commit 836f58d

Browse files
authored
Changed display of markdown editor in tabs
1 parent 70075c1 commit 836f58d

File tree

5 files changed

+38
-13
lines changed

5 files changed

+38
-13
lines changed

public/css/orchid.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/orchid.rtl.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/orchid.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/controllers/simplemde_controller.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,34 @@ export default class extends ApplicationController {
2020
return this.element.querySelector('.upload');
2121
}
2222

23+
initialize() {
24+
25+
this.intersectionObserver = new IntersectionObserver((entries) => this.processIntersectionEntries(entries));
26+
this.intersectionObserver.observe(this.element);
27+
}
28+
29+
processIntersectionEntries(entries) {
30+
entries.forEach((entry) => {
31+
if (!entry.isIntersecting) {
32+
return;
33+
}
34+
35+
this.intersectionObserver.unobserve(this.element);
36+
this.editor = this.initEditor();
37+
38+
});
39+
}
40+
41+
42+
43+
44+
45+
2346
/**
2447
*
2548
*/
26-
connect() {
27-
this.editor = new SimpleMDE({
49+
initEditor() {
50+
const editor = new SimpleMDE({
2851
// Defaults to undefined, which will intelligently check whether
2952
// Font Awesome has already been included, then download accordingly.
3053
autoDownloadFontAwesome: undefined,
@@ -130,6 +153,8 @@ export default class extends ApplicationController {
130153
if (this.textarea.required) {
131154
this.element.querySelector('.CodeMirror textarea').required = true;
132155
}
156+
157+
return editor;
133158
}
134159

135160
/**

0 commit comments

Comments
 (0)