ponkotsu-md-editor 0.2.33 → 0.2.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/markdown_editor.js +14 -6
- data/lib/ponkotsu/md/editor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74a4884c21e34834adb7cdbce5f8c1c442fac80faa0d812b70ad565bedd02266
|
|
4
|
+
data.tar.gz: d4b428b2b0bdc36e6a00171b53cd7087b141727d2a487f6283f7310c06da2bf9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 810d320f1518e59b81268d932966ba42ec4c1fc2d9c9653cf798832f39ce5812a4c712240bb55a2ae85039e67e5d8fc1be0c65466e465fade693a2902533fde9
|
|
7
|
+
data.tar.gz: e8a8bef47b27b09a0a294d672f54f85e90306cb6c5d8516fecaebfb01f29af0c1df27851a61b1288e3c71fb05b9c95671bcb84a30c7ca896baa8f2c157a3c956
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
return () => {
|
|
125
125
|
if (pendingUpdate) return;
|
|
126
126
|
|
|
127
|
-
//
|
|
128
|
-
const currentText = (textarea.
|
|
127
|
+
// テキスト取得
|
|
128
|
+
const currentText = (textarea.innerText || '').replaceAll('\u00A0', ' ');
|
|
129
129
|
|
|
130
130
|
// 変更がない場合はスキップ
|
|
131
131
|
if (currentText === lastValue) return;
|
|
@@ -161,10 +161,18 @@
|
|
|
161
161
|
|
|
162
162
|
// 初期状態でプレースホルダを表示するための空要素チェック
|
|
163
163
|
function updatePlaceholderVisibility() {
|
|
164
|
-
//
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
// innerHTML を一度だけ取得してキャッシュ
|
|
165
|
+
const html = textarea.innerHTML.trim();
|
|
166
|
+
|
|
167
|
+
// 空判定を簡潔に
|
|
168
|
+
const isEmpty = html === '' ||
|
|
169
|
+
html === ' ' ||
|
|
170
|
+
html === '<br>' ||
|
|
171
|
+
html === '<div><br></div>' ||
|
|
172
|
+
html === '<div></div>' ||
|
|
173
|
+
html === '<div> </div>';
|
|
174
|
+
|
|
175
|
+
if (isEmpty) {
|
|
168
176
|
textarea.classList.add('empty');
|
|
169
177
|
} else {
|
|
170
178
|
textarea.classList.remove('empty');
|