From: Vincent Vanwaelscappel Date: Wed, 14 Dec 2022 16:27:45 +0000 (+0100) Subject: wait #5649 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4af8f9c51cfdeb8f613473a695137012857c0f69;p=fluidbook-toolbox.git wait #5649 @0.25 --- diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index 71d4583e9..8e38706f1 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -259,16 +259,16 @@ class Base extends Form $this->addField('header_disposition', FormSection::class, __('Disposition')); $this->addField('group_disposition', FieldGroupStart::class); $this->addField('group_position', FieldGroupStart::class, __('Position')); - $this->addField('x', Text::class, 'X',['suffix'=>'px']); - $this->addField('y', Text::class, 'Y',['suffix'=>'px']); + $this->addField('x', Text::class, 'X', ['suffix' => 'px', 'class' => 'calculation']); + $this->addField('y', Text::class, 'Y', ['suffix' => 'px', 'class' => 'calculation']); $this->addField('group_position_end', FieldGroupEnd::class); $this->addField('group_dimensions', FieldGroupStart::class, __('Dimensions')); - $this->addField('w', Text::class, 'W',['suffix'=>'px']); - $this->addField('h', Text::class, 'H',['suffix'=>'px']); + $this->addField('w', Text::class, 'W', ['suffix' => 'px', 'class' => 'calculation']); + $this->addField('h', Text::class, 'H', ['suffix' => 'px', 'class' => 'calculation']); $this->addField('group_dimensions_end', FieldGroupEnd::class); if ($this->_displayedOnFluidbook) { $this->addField('group_transform', FieldGroupStart::class); - $this->addField('rot', Text::class, __('Rotation'), ['suffix' => '°']); + $this->addField('rot', Text::class, __('Rotation'), ['suffix' => '°', 'class' => 'calculation']); $this->addField('group_transform_end', FieldGroupEnd::class); $this->addField('zindex', Depth::class, __('Profondeur')); } diff --git a/resources/linkeditor/js/linkeditor.form.js b/resources/linkeditor/js/linkeditor.form.js index bf882ce98..ad8f8750d 100644 --- a/resources/linkeditor/js/linkeditor.form.js +++ b/resources/linkeditor/js/linkeditor.form.js @@ -9,6 +9,23 @@ LinkeditorForm.prototype = { init: function () { var $this = this; + $(document).on('change', '.calculation', function () { + var v = $(this).val(); + console.log(v); + if (/[0-9\., \-\+\*\/]+/.test(v)) { + try { + v = eval(v.replace(/,/g, '.')); + console.log(v); + if (isNaN(v)) { + return; + } + } catch (e) { + return; + } + } + $(this).val(v); + }); + $(document).on('change', '#linkeditor-panel-form [name="type"]', function () { console.log('change type'); if ($this._maskChangeEvent) { @@ -18,6 +35,7 @@ LinkeditorForm.prototype = { $this.updateLinkForm(); }); + $(document).on('change', "#linkeditor-panel-form input,#linkeditor-panel-form select,#linkeditor-panel-form textarea", function () { if ($this._maskChangeEvent) { return;