Skip to content

Commit 237995d

Browse files
committed
#514: User sees content snapshot on Category Page in Admin Panel - Added function for changing focus stage on elements, added css classes for PageBuilder field in category form
1 parent 4302e70 commit 237995d

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

app/code/Magento/PageBuilder/view/adminhtml/ui_component/category_form.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
</item>
1919
</item>
2020
</argument>
21+
<settings>
22+
<additionalClasses>
23+
<class name="admin__field-wide admin__field-page-builder">true</class>
24+
</additionalClasses>
25+
</settings>
2126
</field>
2227
</fieldset>
2328
</form>

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/wysiwyg.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ define([
159159

160160
events.on('stage:' + id + ':masterFormatRenderAfter', function (args) {
161161
this.value(args.value);
162+
if (this.wysiwygConfigData()['pagebuilder_content_snapshot']) {
163+
this.pageBuilder.toggleFocusableElements();
164+
}
162165
}.bind(this));
163166

164167
events.on('stage:' + id + ':fullScreenModeChangeAfter', function (args) {

app/code/Magento/PageBuilder/view/adminhtml/web/js/page-builder.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/page-builder.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ export default class PageBuilder implements PageBuilderInterface {
8080
this.isFullScreen.subscribe(() => this.onFullScreenChange());
8181
}
8282

83+
/**
84+
* Changes tabindex and content editable on stage elements.
85+
*/
86+
public toggleFocusableElements () {
87+
const stageWrapper = $("#" + this.id).parent();
88+
let focusableElements = ':focusable:not(.pagebuilder-stage-overlay)';
89+
let editableElements = '[contenteditable]';
90+
let tabIndexValue = this.isFullScreen() ? '0' : '-1';
91+
let editableValue = this.isFullScreen() ? 'true' : 'false';
92+
93+
stageWrapper.find(editableElements).attr('contenteditable', editableValue);
94+
stageWrapper.find(focusableElements).attr('tabindex', tabIndexValue);
95+
}
96+
8397
/**
8498
* Tells the stage wrapper to expand to fullScreen
8599
*
@@ -153,6 +167,7 @@ export default class PageBuilder implements PageBuilderInterface {
153167
$("body").css("overflow", "");
154168
}
155169

170+
this.toggleFocusableElements();
156171
events.trigger(`stage:${ this.id }:fullScreenModeChangeAfter`, {
157172
fullScreen: this.isFullScreen(),
158173
});

0 commit comments

Comments
 (0)