Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Oct 26, 2023
1 parent 43b5961 commit 051592e
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/admin/src/FormField/PageSearchExcreptField.php
Expand Up @@ -23,7 +23,7 @@ public function formField(FormMapper $form): FormMapper
'label' => 'admin.page.searchExcrept.label',
'help_html' => true,
'help' => 'admin.page.searchExcrept.help',
'attr' => ['class' => 'autosize'],
'attr' => ['class' => 'descToMeasure autosize textarea-no-newline'],
]);
}
}
22 changes: 13 additions & 9 deletions packages/admin/src/Resources/assets/admin.js
Expand Up @@ -28,6 +28,7 @@ window.addEventListener("load", function () {
// ...
easyMDEditor();
showTitlePixelWidth();
showTitlePixelWidth('desc', 150);
memorizeOpenPannel();
onDomChanged();
textareaWithoutNewLine();
Expand Down Expand Up @@ -102,22 +103,25 @@ function copyElementText(element) {
document.body.removeChild(elem);
}

function showTitlePixelWidth() {
function showTitlePixelWidth(toMeasure = 'title', maxLenght = 70) {
// todo abstract it (showPixelWith(element))
if (!$(".titleToMeasure").length) return;
if (!$('.' + toMeasure + 'ToMeasure').length) return;

var input = document.querySelector(".titleToMeasure");
var resultWrapper = document.getElementById("titleWidth");
var input = document.querySelector('.' + toMeasure + 'ToMeasure');
var resultWrapper = document.getElementById('' + toMeasure + 'Width');
function updateTitleWidth() {
resultWrapper.style =
"font-size:20px;margin:0;padding:0;border:0;font-weight:400;display:inline-block;font-family:arial,sans-serif;line-height: 1.3;";
'font-size:20px;margin:0;padding:0;border:0;font-weight:400;display:inline-block;font-family:arial,sans-serif;line-height: 1.3;';
resultWrapper.innerHTML = input.value;
var titleWidth = resultWrapper.offsetWidth;
resultWrapper.innerHTML = titleWidth + "px";
resultWrapper.style = titleWidth > 560 ? "color:#B0413E" : "color:#4F805D";
//var titleWidth = resultWrapper.offsetWidth;
//resultWrapper.innerHTML = titleWidth + "px";
var titleLenght = input.value.length;
resultWrapper.innerHTML = titleLenght;
//resultWrapper.style = titleWidth > 560 ? "color:#B0413E" : "color:#4F805D";
resultWrapper.style = titleLenght > maxLenght ? 'color:#B0413E' : 'color:#4F805D';
}
updateTitleWidth();
input.addEventListener("input", updateTitleWidth);
input.addEventListener('input', updateTitleWidth);
}

function columnSizeManager() {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Resources/public/ace/ace.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/admin/src/Resources/public/ace/astro.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/admin/src/Resources/public/ace/ext-modelist.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 051592e

Please sign in to comment.