ponkotsu-md-editor 0.2.33 → 0.2.34

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: e3b1c79f7f7011ffcd76111ea8598c5346790a17feb8c0a6e7f34b1ff7109176
4
+ data.tar.gz: 753c49c6d2c30d63059ff982b4f0620cecf94f6f1e5ef2b00f70814112dc35ee
5
5
  SHA512:
6
- metadata.gz: bac62356700052a2be43f8a9a7710f9bebda2c7109afbc62bc48c7fd7f617c150becd6959d0ab7ba830b76670673b03a3cbd4636ad4461e5533bffc756d581ce
7
- data.tar.gz: 4a0f6612cc409a4e255fdb8868624bbf618d39979513e946cb14db8e888d4cb7f484077c9bff7bd045ffc9a6e04395b3a13097b64b7122052c9c4f3eadb3db9d
6
+ metadata.gz: 0337a5e3775a7b445a0eec9dfb92c2f3eeda5925fafdcb408496a2010bebb9bc0ab63d1689b45de015a0946c0a5c7674f1b0f8a76f1e9bd2b464e1828eaf8963
7
+ data.tar.gz: 719c69fa598fb5a7983cf8ab277c3d4246763569eeb1e72e9083bd9040fbbc37f0fadce92ddca229c3eae3719d1ad22d5d8431f198a5136a9c5ec90909b65ff8
@@ -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.34"
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.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler