markdown-text-editor 0.0.21-beta.2 → 0.0.23-beta.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": "markdown-text-editor",
3
- "version": "0.0.21-beta.2",
3
+ "version": "0.0.23-beta.3",
4
4
  "description": "A powerful, easy-to-use Markdown editor with a real-time preview, syntax highlighting. Ideal for developers, writers, and content creators who need a seamless, interactive writing experience with full Markdown support.",
5
5
  "main": "./dist/markdown-text-editor.js",
6
6
  "browser": "dist/markdown-text-editor.js",
@@ -14,10 +14,10 @@
14
14
  "url": "https://github.com/nezanuha/markdown-text-editor"
15
15
  },
16
16
  "scripts": {
17
- "clean": "rm -rf dist",
17
+ "clean": "rimraf dist",
18
18
  "build": "npm run clean && webpack --mode=production",
19
19
  "prepublishOnly": "npm run build",
20
- "dev": "webpack --watch --mode=development"
20
+ "dev": "webpack serve --mode=development"
21
21
  },
22
22
  "publishConfig": {
23
23
  "registry": "https://registry.npmjs.org/"
@@ -51,13 +51,15 @@
51
51
  "autoprefixer": "^10.4.20",
52
52
  "babel-loader": "^9.2.1",
53
53
  "css-loader": "^7.1.2",
54
+ "html-webpack-plugin": "^5.6.3",
54
55
  "mini-css-extract-plugin": "^2.9.1",
55
56
  "postcss": "^8.4.47",
56
57
  "postcss-loader": "^8.1.1",
58
+ "rimraf": "^6.0.1",
57
59
  "style-loader": "^4.0.0",
58
60
  "terser-webpack-plugin": "^5.3.11",
59
61
  "webpack": "^5.95.0",
60
62
  "webpack-cli": "^6.0.1",
61
- "webpack-dev-server": "^5.1.0"
63
+ "webpack-dev-server": "^5.2.0"
62
64
  }
63
65
  }
@@ -11,6 +11,7 @@ class MarkdownTool {
11
11
  createButton(iconHtml) {
12
12
  const button = document.createElement('button');
13
13
  button.innerHTML = iconHtml; // Pass icon HTML from child classes
14
+ button.type='button';
14
15
  button.className = 'markdown-btn p-2 hover:bg-stone-200 dark:hover:bg-stone-600 rounded duration-300';
15
16
  button.addEventListener('click', () => this.applySyntax());
16
17
  return button;
@@ -36,6 +36,7 @@ class PreviewTool extends MarkdownTool {
36
36
  editorDiv.parentNode.classList.toggle('top-0');
37
37
  editorDiv.parentNode.classList.toggle('inset-x-0');
38
38
  editorDiv.parentNode.classList.toggle('rounded-md');
39
+ editorDiv.parentNode.classList.toggle('z-[999]');
39
40
 
40
41
  previewWrapper.classList.toggle('hidden');
41
42
 
@@ -44,16 +45,19 @@ class PreviewTool extends MarkdownTool {
44
45
  'md:grid',
45
46
  'md:grid-cols-2',
46
47
  'md:divide-x',
48
+ 'rtl:md:divide-x-reverse',
47
49
  'md:divide-stone-300',
48
50
  'dark:md:divide-stone-700'
49
51
  );
50
52
 
51
53
  editorDiv.querySelector(".textarea-wrapper").classList.remove(
52
- 'h-lvh',
54
+ 'h-[90lvh]',
53
55
  'hidden',
54
56
  'md:block'
55
57
  );
56
58
  this.editor.render(); // Re-render content in the preview
59
+
60
+ editorDiv.querySelector(".textarea-wrapper").querySelector("textarea").classList.remove("!h-[90lvh]");
57
61
 
58
62
  document.querySelector("body").classList.remove('overflow-hidden');
59
63
  }
@@ -67,6 +71,7 @@ class PreviewTool extends MarkdownTool {
67
71
  editorDiv.parentNode.classList.toggle('top-0');
68
72
  editorDiv.parentNode.classList.toggle('inset-x-0');
69
73
  editorDiv.parentNode.classList.toggle('rounded-md');
74
+ editorDiv.parentNode.classList.toggle('z-[999]');
70
75
 
71
76
  previewWrapper.classList.toggle('hidden');
72
77
  // Remove grid layout and divide classes from the editor div
@@ -74,16 +79,17 @@ class PreviewTool extends MarkdownTool {
74
79
  'md:grid',
75
80
  'md:grid-cols-2',
76
81
  'md:divide-x',
82
+ 'rtl:md:divide-x-reverse',
77
83
  'md:divide-stone-300',
78
84
  'dark:md:divide-stone-700'
79
85
  );
80
86
 
81
87
  editorDiv.querySelector(".textarea-wrapper").classList.add(
82
- 'h-lvh',
88
+ 'h-[90lvh]',
83
89
  'hidden',
84
90
  'md:block'
85
91
  );
86
- // editorDiv.closest(".textarea-wrapper>textarea").classList.add("h-lvh");
92
+ editorDiv.querySelector(".textarea-wrapper").querySelector("textarea").classList.add("!h-[90lvh]");
87
93
 
88
94
  document.querySelector("body").classList.add('overflow-hidden');
89
95
  }
@@ -36,6 +36,8 @@ class MarkdownEditor {
36
36
 
37
37
  applyDefaultAttributes() {
38
38
  this.usertextarea.classList.add(
39
+ "focus:outline-0",
40
+ "border-0",
39
41
  "p-1.5",
40
42
  "max-w-full",
41
43
  "size-full",
@@ -4,7 +4,7 @@ class Preview {
4
4
  this.previewContainer = document.createElement('div');
5
5
  this.previewContainer.className = 'preview-wrapper bg-white dark:bg-stone-800 p-2 hidden';
6
6
  this.previewContent = document.createElement('div');
7
- this.previewContent.className = 'preview-content prose prose-sm md:prose-base dark:prose-invert p-1.5 overflow-y-auto h-lvh max-w-max';
7
+ this.previewContent.className = 'preview-content prose prose-sm md:prose-base dark:prose-invert p-1.5 overflow-y-auto h-[90lvh] max-w-max';
8
8
  this.previewContainer.appendChild(this.previewContent);
9
9
  container.appendChild(this.previewContainer);
10
10
  }