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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7340ba8c2ac893d51238f60395be14004050920c09de9ffe172e47af8736fa8
4
- data.tar.gz: 383aa9b69c43ab1319cd17b675402dfc7fcf94f44c5ad140c0fe3efa64190c5d
3
+ metadata.gz: 74a4884c21e34834adb7cdbce5f8c1c442fac80faa0d812b70ad565bedd02266
4
+ data.tar.gz: d4b428b2b0bdc36e6a00171b53cd7087b141727d2a487f6283f7310c06da2bf9
5
5
  SHA512:
6
- metadata.gz: bac62356700052a2be43f8a9a7710f9bebda2c7109afbc62bc48c7fd7f617c150becd6959d0ab7ba830b76670673b03a3cbd4636ad4461e5533bffc756d581ce
7
- data.tar.gz: 4a0f6612cc409a4e255fdb8868624bbf618d39979513e946cb14db8e888d4cb7f484077c9bff7bd045ffc9a6e04395b3a13097b64b7122052c9c4f3eadb3db9d
6
+ metadata.gz: 810d320f1518e59b81268d932966ba42ec4c1fc2d9c9653cf798832f39ce5812a4c712240bb55a2ae85039e67e5d8fc1be0c65466e465fade693a2902533fde9
7
+ data.tar.gz: e8a8bef47b27b09a0a294d672f54f85e90306cb6c5d8516fecaebfb01f29af0c1df27851a61b1288e3c71fb05b9c95671bcb84a30c7ca896baa8f2c157a3c956
@@ -124,8 +124,8 @@
124
124
  return () => {
125
125
  if (pendingUpdate) return;
126
126
 
127
- // テキスト取得(innerTextよりtextContentの方が高速)
128
- const currentText = (textarea.textContent || '').replaceAll('\u00A0', ' ');
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
- // <br>のみの場合も空とみなす
165
- if (textarea.innerHTML.trim() === '&nbsp;' || textarea.innerHTML.trim() === ''
166
- || textarea.innerHTML.trim() === '\<br\>'
167
- || textarea.innerHTML.trim() === '<div> </div>') {
164
+ // innerHTML を一度だけ取得してキャッシュ
165
+ const html = textarea.innerHTML.trim();
166
+
167
+ // 空判定を簡潔に
168
+ const isEmpty = html === '' ||
169
+ html === '&nbsp;' ||
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');
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PonkotsuMdEditor
4
- VERSION = "0.2.33"
4
+ VERSION = "0.2.35"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ponkotsu-md-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.33
4
+ version: 0.2.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler