drakosfire commited on
Commit
ac9f06d
1 Parent(s): 13f10a1

added offset to adjustTextareaHeight for title block and description-textarea, made sure description-textarea height is adjusted correctly

Browse files
Files changed (1) hide show
  1. scripts.js +19 -12
scripts.js CHANGED
@@ -151,10 +151,8 @@ document.addEventListener("DOMContentLoaded", function() {
151
  const lastPageInContainer = pageContainer.querySelector('.page:last-child');
152
  if (lastPageInContainer !== currentPage) {
153
  currentPage = lastPageInContainer;
154
- console.log('Moved to a new page:', currentPage.getAttribute('data-page-id')); }
155
-
156
-
157
-
158
  });
159
  console.log('Autofill complete, all blocks moved to page-container');
160
  }
@@ -180,9 +178,6 @@ document.addEventListener("DOMContentLoaded", function() {
180
 
181
  .page {
182
  page-break-before: auto;
183
- page-break-after: avoid;
184
- page-break-inside: avoid;
185
-
186
  }
187
  .columnWrapper {
188
  overflow: visible;
@@ -192,7 +187,11 @@ document.addEventListener("DOMContentLoaded", function() {
192
  </style>
193
  </head>
194
  <body>
195
- ${pageContainer.innerHTML}
 
 
 
 
196
  </body>
197
  </html>
198
  `;
@@ -322,10 +321,10 @@ document.addEventListener("DOMContentLoaded", function() {
322
 
323
  storeInitialPositions();
324
 
325
- function adjustTextareaHeight(el) {
326
  if (el.scrollHeight > 16){
327
  el.style.height = 'auto';
328
- el.style.height = (el.scrollHeight) + 'px';
329
  }
330
  }
331
 
@@ -337,10 +336,18 @@ document.addEventListener("DOMContentLoaded", function() {
337
  'properties-textarea',
338
  'string-stat-textarea',
339
  'string-action-description-textarea',
340
- 'image-textarea'
 
341
  ];
342
 
343
  classes.forEach(className => {
 
 
 
 
 
 
 
344
  console.log('Initializing textareas for class:', className);
345
  console.log(document.querySelectorAll(`.${className}`));
346
  const textareas = document.querySelectorAll(`.${className}`);
@@ -348,7 +355,7 @@ document.addEventListener("DOMContentLoaded", function() {
348
  console.log('Textarea found:', textarea);
349
 
350
  // Adjust height on page load
351
- adjustTextareaHeight(textarea);
352
  // Adjust height on input
353
  textarea.addEventListener('input', function() {
354
  adjustTextareaHeight(textarea);
 
151
  const lastPageInContainer = pageContainer.querySelector('.page:last-child');
152
  if (lastPageInContainer !== currentPage) {
153
  currentPage = lastPageInContainer;
154
+ console.log('Moved to a new page:', currentPage.getAttribute('data-page-id'));
155
+ }
 
 
156
  });
157
  console.log('Autofill complete, all blocks moved to page-container');
158
  }
 
178
 
179
  .page {
180
  page-break-before: auto;
 
 
 
181
  }
182
  .columnWrapper {
183
  overflow: visible;
 
187
  </style>
188
  </head>
189
  <body>
190
+ <div id="pageContainer" class="page-container">
191
+ <div id= "brewRenderer" class="brewRenderer">
192
+ ${pageContainer.innerHTML}
193
+ </div>
194
+ </div>
195
  </body>
196
  </html>
197
  `;
 
321
 
322
  storeInitialPositions();
323
 
324
+ function adjustTextareaHeight(el, offset = 0) {
325
  if (el.scrollHeight > 16){
326
  el.style.height = 'auto';
327
+ el.style.height = (el.scrollHeight) + offset + 'px';
328
  }
329
  }
330
 
 
336
  'properties-textarea',
337
  'string-stat-textarea',
338
  'string-action-description-textarea',
339
+ 'image-textarea',
340
+ 'title-textarea'
341
  ];
342
 
343
  classes.forEach(className => {
344
+ if (className === 'description-textarea') {
345
+ console.log('Class is ', className, 'offset is 5');
346
+ offset = 10;
347
+ } else {
348
+ offset = 0;
349
+ }
350
+
351
  console.log('Initializing textareas for class:', className);
352
  console.log(document.querySelectorAll(`.${className}`));
353
  const textareas = document.querySelectorAll(`.${className}`);
 
355
  console.log('Textarea found:', textarea);
356
 
357
  // Adjust height on page load
358
+ adjustTextareaHeight(textarea, offset);
359
  // Adjust height on input
360
  textarea.addEventListener('input', function() {
361
  adjustTextareaHeight(textarea);