ninegrid2 6.1335.0 → 6.1338.0

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.
@@ -55344,25 +55344,30 @@ class nxEditor extends nxDiv {
55344
55344
  }
55345
55345
 
55346
55346
  #updateMenuState(editor) {
55347
+ // 1. 일반 커맨드 버튼 상태 업데이트
55347
55348
  this.shadowRoot.querySelectorAll('[data-cmd]').forEach(btn => {
55348
55349
  if (editor.isActive(btn.dataset.cmd)) btn.classList.add('is-active');
55349
55350
  else btn.classList.remove('is-active');
55350
55351
  });
55351
55352
 
55353
+ // 2. 정렬 상태 업데이트
55352
55354
  this.shadowRoot.querySelectorAll('[data-align]').forEach(btn => {
55353
55355
  if (editor.isActive({ textAlign: btn.dataset.align })) btn.classList.add('is-active');
55354
55356
  else btn.classList.remove('is-active');
55355
55357
  });
55356
55358
 
55357
- // 현재 선택 영역의 폰트 사이즈를 가져와 셀렉트 박스에 반영
55358
- const fontSize = editor.getAttributes('textStyle').fontSize;
55359
- console.log(fontSize);
55359
+ // 3. 폰트 사이즈 업데이트
55360
+ const attrs = editor.getAttributes('textStyle');
55360
55361
  const select = this.shadowRoot.querySelector('#font-size');
55361
- console.log(select);
55362
- if (fontSize) {
55363
- select.value = fontSize;
55364
- } else {
55365
- select.value = '14px'; // 기본값
55362
+ if (select) {
55363
+ select.value = attrs.fontSize || '14px'; // 값이 없으면 기본값
55364
+ }
55365
+
55366
+ // 4. 글자 색상 업데이트 (추가된 부분)
55367
+ const colorPicker = this.shadowRoot.querySelector('#color-picker');
55368
+ if (colorPicker) {
55369
+ // Tiptap에서 가져온 색상값이 있으면 적용, 없으면 기본 검정색(#000000)
55370
+ colorPicker.value = attrs.color || '#000000';
55366
55371
  }
55367
55372
  }
55368
55373
 
@@ -55340,25 +55340,30 @@ class nxEditor extends nxDiv {
55340
55340
  }
55341
55341
 
55342
55342
  #updateMenuState(editor) {
55343
+ // 1. 일반 커맨드 버튼 상태 업데이트
55343
55344
  this.shadowRoot.querySelectorAll('[data-cmd]').forEach(btn => {
55344
55345
  if (editor.isActive(btn.dataset.cmd)) btn.classList.add('is-active');
55345
55346
  else btn.classList.remove('is-active');
55346
55347
  });
55347
55348
 
55349
+ // 2. 정렬 상태 업데이트
55348
55350
  this.shadowRoot.querySelectorAll('[data-align]').forEach(btn => {
55349
55351
  if (editor.isActive({ textAlign: btn.dataset.align })) btn.classList.add('is-active');
55350
55352
  else btn.classList.remove('is-active');
55351
55353
  });
55352
55354
 
55353
- // 현재 선택 영역의 폰트 사이즈를 가져와 셀렉트 박스에 반영
55354
- const fontSize = editor.getAttributes('textStyle').fontSize;
55355
- console.log(fontSize);
55355
+ // 3. 폰트 사이즈 업데이트
55356
+ const attrs = editor.getAttributes('textStyle');
55356
55357
  const select = this.shadowRoot.querySelector('#font-size');
55357
- console.log(select);
55358
- if (fontSize) {
55359
- select.value = fontSize;
55360
- } else {
55361
- select.value = '14px'; // 기본값
55358
+ if (select) {
55359
+ select.value = attrs.fontSize || '14px'; // 값이 없으면 기본값
55360
+ }
55361
+
55362
+ // 4. 글자 색상 업데이트 (추가된 부분)
55363
+ const colorPicker = this.shadowRoot.querySelector('#color-picker');
55364
+ if (colorPicker) {
55365
+ // Tiptap에서 가져온 색상값이 있으면 적용, 없으면 기본 검정색(#000000)
55366
+ colorPicker.value = attrs.color || '#000000';
55362
55367
  }
55363
55368
  }
55364
55369
 
@@ -156,25 +156,30 @@ class nxEditor extends nxDiv {
156
156
  }
157
157
 
158
158
  #updateMenuState(editor) {
159
+ // 1. 일반 커맨드 버튼 상태 업데이트
159
160
  this.shadowRoot.querySelectorAll('[data-cmd]').forEach(btn => {
160
161
  if (editor.isActive(btn.dataset.cmd)) btn.classList.add('is-active');
161
162
  else btn.classList.remove('is-active');
162
163
  });
163
164
 
165
+ // 2. 정렬 상태 업데이트
164
166
  this.shadowRoot.querySelectorAll('[data-align]').forEach(btn => {
165
167
  if (editor.isActive({ textAlign: btn.dataset.align })) btn.classList.add('is-active');
166
168
  else btn.classList.remove('is-active');
167
169
  });
168
170
 
169
- // 현재 선택 영역의 폰트 사이즈를 가져와 셀렉트 박스에 반영
170
- const fontSize = editor.getAttributes('textStyle').fontSize;
171
- console.log(fontSize);
171
+ // 3. 폰트 사이즈 업데이트
172
+ const attrs = editor.getAttributes('textStyle');
172
173
  const select = this.shadowRoot.querySelector('#font-size');
173
- console.log(select);
174
- if (fontSize) {
175
- select.value = fontSize;
176
- } else {
177
- select.value = '14px'; // 기본값
174
+ if (select) {
175
+ select.value = attrs.fontSize || '14px'; // 값이 없으면 기본값
176
+ }
177
+
178
+ // 4. 글자 색상 업데이트 (추가된 부분)
179
+ const colorPicker = this.shadowRoot.querySelector('#color-picker');
180
+ if (colorPicker) {
181
+ // Tiptap에서 가져온 색상값이 있으면 적용, 없으면 기본 검정색(#000000)
182
+ colorPicker.value = attrs.color || '#000000';
178
183
  }
179
184
  }
180
185
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.1335.0",
4
+ "version": "6.1338.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -156,25 +156,30 @@ class nxEditor extends nxDiv {
156
156
  }
157
157
 
158
158
  #updateMenuState(editor) {
159
+ // 1. 일반 커맨드 버튼 상태 업데이트
159
160
  this.shadowRoot.querySelectorAll('[data-cmd]').forEach(btn => {
160
161
  if (editor.isActive(btn.dataset.cmd)) btn.classList.add('is-active');
161
162
  else btn.classList.remove('is-active');
162
163
  });
163
164
 
165
+ // 2. 정렬 상태 업데이트
164
166
  this.shadowRoot.querySelectorAll('[data-align]').forEach(btn => {
165
167
  if (editor.isActive({ textAlign: btn.dataset.align })) btn.classList.add('is-active');
166
168
  else btn.classList.remove('is-active');
167
169
  });
168
170
 
169
- // 현재 선택 영역의 폰트 사이즈를 가져와 셀렉트 박스에 반영
170
- const fontSize = editor.getAttributes('textStyle').fontSize;
171
- console.log(fontSize);
171
+ // 3. 폰트 사이즈 업데이트
172
+ const attrs = editor.getAttributes('textStyle');
172
173
  const select = this.shadowRoot.querySelector('#font-size');
173
- console.log(select);
174
- if (fontSize) {
175
- select.value = fontSize;
176
- } else {
177
- select.value = '14px'; // 기본값
174
+ if (select) {
175
+ select.value = attrs.fontSize || '14px'; // 값이 없으면 기본값
176
+ }
177
+
178
+ // 4. 글자 색상 업데이트 (추가된 부분)
179
+ const colorPicker = this.shadowRoot.querySelector('#color-picker');
180
+ if (colorPicker) {
181
+ // Tiptap에서 가져온 색상값이 있으면 적용, 없으면 기본 검정색(#000000)
182
+ colorPicker.value = attrs.color || '#000000';
178
183
  }
179
184
  }
180
185