diff --git a/features/personas/AddLocation.feature b/features/personas/AddLocation.feature
index 88422a2658..4328a589ed 100644
--- a/features/personas/AddLocation.feature
+++ b/features/personas/AddLocation.feature
@@ -7,7 +7,7 @@ Feature: Verify that an Editor with Content Type limitation on content/create po
And I log in as "Add" with password "Passw0rd-42"
And I go to "Content structure" in "Content" tab
And I navigate to content "NewArticle" of type "Article" in root
- And I am using the DXP in "Expert" mode
+ And I am using the DXP with Focus mode disabled
When I switch to "Locations" tab in Content structure
And I add a new Location under "root/Destination"
Then there exists Content view Page for "root/Destination/NewArticle"
diff --git a/src/bundle/Controller/User/UserModeController.php b/src/bundle/Controller/User/FocusModeController.php
similarity index 75%
rename from src/bundle/Controller/User/UserModeController.php
rename to src/bundle/Controller/User/FocusModeController.php
index 45025b2591..00f22e06a3 100644
--- a/src/bundle/Controller/User/UserModeController.php
+++ b/src/bundle/Controller/User/FocusModeController.php
@@ -8,16 +8,16 @@
namespace Ibexa\Bundle\AdminUi\Controller\User;
-use Ibexa\AdminUi\Form\Data\User\UserModeChangeData;
-use Ibexa\AdminUi\Form\Type\User\UserModeChangeType;
-use Ibexa\AdminUi\UserSetting\UserMode;
+use Ibexa\AdminUi\Form\Data\User\FocusModeChangeData;
+use Ibexa\AdminUi\Form\Type\User\FocusModeChangeType;
+use Ibexa\AdminUi\UserSetting\FocusMode;
use Ibexa\Contracts\AdminUi\Controller\Controller;
use Ibexa\User\UserSetting\UserSettingService;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
-final class UserModeController extends Controller
+final class FocusModeController extends Controller
{
private const RETURN_URL_PARAM = 'returnUrl';
@@ -30,15 +30,15 @@ public function __construct(UserSettingService $userSettingService)
public function changeAction(Request $request, ?string $returnUrl): Response
{
- $data = new UserModeChangeData();
- $data->setMode($this->userSettingService->getUserSetting(UserMode::IDENTIFIER)->value === UserMode::EXPERT);
+ $data = new FocusModeChangeData();
+ $data->setEnabled($this->userSettingService->getUserSetting(FocusMode::IDENTIFIER)->value === FocusMode::FOCUS_MODE_ON);
$form = $this->createForm(
- UserModeChangeType::class,
+ FocusModeChangeType::class,
$data,
[
'action' => $this->generateUrl(
- 'ibexa.user_mode.change',
+ 'ibexa.focus_mode.change',
[
self::RETURN_URL_PARAM => $returnUrl,
]
@@ -50,15 +50,15 @@ public function changeAction(Request $request, ?string $returnUrl): Response
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->userSettingService->setUserSetting(
- UserMode::IDENTIFIER,
- $data->getMode() ? UserMode::EXPERT : UserMode::SMART
+ FocusMode::IDENTIFIER,
+ $data->isEnabled() ? FocusMode::FOCUS_MODE_ON : FocusMode::FOCUS_MODE_OFF
);
return $this->createRedirectToReturnUrl($request);
}
return $this->render(
- '@ibexadesign/ui/user_mode_form.html.twig',
+ '@ibexadesign/ui/focus_mode_form.html.twig',
[
'form' => $form->createView(),
]
diff --git a/src/bundle/DependencyInjection/Configuration/Parser/AdminUiParser.php b/src/bundle/DependencyInjection/Configuration/Parser/AdminUiParser.php
index c50215dddc..0c454ca3df 100644
--- a/src/bundle/DependencyInjection/Configuration/Parser/AdminUiParser.php
+++ b/src/bundle/DependencyInjection/Configuration/Parser/AdminUiParser.php
@@ -8,7 +8,7 @@
namespace Ibexa\Bundle\AdminUi\DependencyInjection\Configuration\Parser;
-use Ibexa\AdminUi\UserSetting\UserMode;
+use Ibexa\AdminUi\UserSetting\FocusMode;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;
@@ -21,14 +21,14 @@
* system:
* default: # configuration per siteaccess or siteaccess group
* admin_ui:
- * default_user_mode: smart
+ * default_focus_mode: on
* ```
*/
final class AdminUiParser extends AbstractParser
{
private const MODES = [
- 'expert' => UserMode::EXPERT,
- 'smart' => UserMode::SMART,
+ 'off' => FocusMode::FOCUS_MODE_OFF,
+ 'on' => FocusMode::FOCUS_MODE_ON,
];
/**
@@ -52,9 +52,9 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$root = $nodeBuilder->arrayNode('admin_ui');
$root->children()
- ->enumNode('default_user_mode')
- ->info('Default user mode setting')
- ->values(['smart', 'expert'])
+ ->enumNode('default_focus_mode')
+ ->info('Default focus mode value')
+ ->values(['on', 'off'])
->end()
->end();
}
@@ -67,14 +67,14 @@ private function addUserModeParameters(
string $currentScope,
ContextualizerInterface $contextualizer
): void {
- $userMode = $settings['default_user_mode'];
+ $userMode = $settings['default_focus_mode'];
if (!array_key_exists($userMode, self::MODES)) {
return;
}
$contextualizer->setContextualParameter(
- 'admin_ui.default_user_mode',
+ 'admin_ui.default_focus_mode',
$currentScope,
self::MODES[$userMode]
);
diff --git a/src/bundle/Resources/config/default_parameters.yaml b/src/bundle/Resources/config/default_parameters.yaml
index 8be5cee2f0..be565731e7 100644
--- a/src/bundle/Resources/config/default_parameters.yaml
+++ b/src/bundle/Resources/config/default_parameters.yaml
@@ -77,4 +77,4 @@ parameters:
ibexa.admin_ui.content_tree.node_factory.max_location_ids_in_single_aggregation: 100
- ibexa.site_access.config.default.admin_ui.default_user_mode: '1'
+ ibexa.site_access.config.default.admin_ui.default_focus_mode: '1'
diff --git a/src/bundle/Resources/config/routing.yaml b/src/bundle/Resources/config/routing.yaml
index bce3c86bfa..7061df744f 100644
--- a/src/bundle/Resources/config/routing.yaml
+++ b/src/bundle/Resources/config/routing.yaml
@@ -965,9 +965,9 @@ ibexa.permission.limitation.language.content_read:
contentInfoId: \d+
-### User Mode
+### Focus Mode
-ibexa.user_mode.change:
- path: /user/change-mode
- controller: 'Ibexa\Bundle\AdminUi\Controller\User\UserModeController::changeAction'
+ibexa.focus_mode.change:
+ path: /user/focus-mode
+ controller: 'Ibexa\Bundle\AdminUi\Controller\User\FocusModeController::changeAction'
methods: [GET, POST]
diff --git a/src/bundle/Resources/config/services/controllers.yaml b/src/bundle/Resources/config/services/controllers.yaml
index 9c6adb1153..2d457e3d12 100644
--- a/src/bundle/Resources/config/services/controllers.yaml
+++ b/src/bundle/Resources/config/services/controllers.yaml
@@ -191,7 +191,7 @@ services:
tags:
- controller.service_arguments
- Ibexa\Bundle\AdminUi\Controller\User\UserModeController:
+ Ibexa\Bundle\AdminUi\Controller\User\FocusModeController:
parent: Ibexa\Contracts\AdminUi\Controller\Controller
autowire: true
tags:
diff --git a/src/bundle/Resources/config/services/twig.yaml b/src/bundle/Resources/config/services/twig.yaml
index 276c9b87da..21d61534a4 100644
--- a/src/bundle/Resources/config/services/twig.yaml
+++ b/src/bundle/Resources/config/services/twig.yaml
@@ -26,7 +26,7 @@ services:
tags:
- { name: twig.extension }
- Ibexa\Bundle\AdminUi\Templating\Twig\UserModeExtension:
+ Ibexa\Bundle\AdminUi\Templating\Twig\FocusModeExtension:
tags:
- { name: twig.extension }
diff --git a/src/bundle/Resources/config/services/user_settings.yaml b/src/bundle/Resources/config/services/user_settings.yaml
index 84e4139290..564a18ffa8 100644
--- a/src/bundle/Resources/config/services/user_settings.yaml
+++ b/src/bundle/Resources/config/services/user_settings.yaml
@@ -30,7 +30,7 @@ services:
tags:
- { name: ibexa.user.setting.group, identifier: mode, priority: -10 }
- Ibexa\AdminUi\UserSetting\UserMode:
+ Ibexa\AdminUi\UserSetting\FocusMode:
tags:
- - { name: ibexa.user.setting.value, identifier: user_mode, group: mode, priority: 10 }
- - { name: ibexa.user.setting.mapper.form, identifier: user_mode }
+ - { name: ibexa.user.setting.value, identifier: focus_mode, group: mode, priority: 10 }
+ - { name: ibexa.user.setting.mapper.form, identifier: focus_mode }
diff --git a/src/bundle/Resources/encore/ibexa.js.config.js b/src/bundle/Resources/encore/ibexa.js.config.js
index 72deeb9054..eb915cc0ae 100644
--- a/src/bundle/Resources/encore/ibexa.js.config.js
+++ b/src/bundle/Resources/encore/ibexa.js.config.js
@@ -38,8 +38,8 @@ const layout = [
path.resolve(__dirname, '../public/js/scripts/admin.form.autosubmit.js'),
path.resolve(__dirname, '../public/js/scripts/admin.anchor.navigation'),
path.resolve(__dirname, '../public/js/scripts/admin.context.menu'),
+ path.resolve(__dirname, '../public/js/scripts/admin.distraction.free.mode.js'),
path.resolve(__dirname, '../public/js/scripts/admin.focus.mode.js'),
- path.resolve(__dirname, '../public/js/scripts/admin.user.mode.js'),
path.resolve(__dirname, '../public/js/scripts/sidebar/main.menu.js'),
path.resolve(__dirname, '../public/js/scripts/admin.input.text.js'),
path.resolve(__dirname, '../public/js/scripts/admin.table.js'),
diff --git a/src/bundle/Resources/public/js/scripts/admin.distraction.free.mode.js b/src/bundle/Resources/public/js/scripts/admin.distraction.free.mode.js
new file mode 100644
index 0000000000..99f0f0f147
--- /dev/null
+++ b/src/bundle/Resources/public/js/scripts/admin.distraction.free.mode.js
@@ -0,0 +1,65 @@
+(function (global, doc) {
+ let activeFieldEdit = null;
+ const DISTRACTION_FREE_MODE_ENABLE_EVENT_NAME = 'ibexa-distraction-free:enable';
+ const DISTRACTION_FREE_DISABLE_EVENT_NAME = 'ibexa-distraction-free:disable';
+ const distractionFreeModeEnableBtns = doc.querySelectorAll('.ibexa-field-edit__distraction-free-mode-control-btn--enable');
+ const distractionFreeModeDisableBtns = doc.querySelectorAll('.ibexa-field-edit__distraction-free-mode-control-btn--disable');
+ const changeDistractionFreeModeState = (active) => {
+ if (!activeFieldEdit) {
+ return;
+ }
+
+ const dispatchEventName = active ? DISTRACTION_FREE_MODE_ENABLE_EVENT_NAME : DISTRACTION_FREE_DISABLE_EVENT_NAME;
+ const editorSourceElement = activeFieldEdit.querySelector('.ibexa-data-source__richtext');
+ const editorInstance = editorSourceElement.ckeditorInstance;
+
+ activeFieldEdit.classList.toggle('ibexa-field-edit--distraction-free-mode-active', active);
+ editorInstance.set('distractionFreeModeActive', active);
+
+ doc.body.dispatchEvent(
+ new CustomEvent(dispatchEventName, {
+ detail: {
+ activeFieldEdit,
+ },
+ }),
+ );
+
+ if (!active) {
+ activeFieldEdit = null;
+ }
+ };
+ const handleKeyPress = (event) => {
+ if (event.key === 'Escape') {
+ changeDistractionFreeModeState(false);
+ }
+ };
+
+ distractionFreeModeEnableBtns.forEach((btn) => {
+ btn.addEventListener(
+ 'click',
+ ({ currentTarget }) => {
+ activeFieldEdit = currentTarget.closest('.ibexa-field-edit');
+ changeDistractionFreeModeState(true);
+ },
+ false,
+ );
+ });
+ distractionFreeModeDisableBtns.forEach((btn) => {
+ btn.addEventListener('click', () => changeDistractionFreeModeState(false), false);
+ });
+
+ doc.body.addEventListener(
+ DISTRACTION_FREE_MODE_ENABLE_EVENT_NAME,
+ () => {
+ doc.body.addEventListener('keydown', handleKeyPress, false);
+ },
+ false,
+ );
+ doc.body.addEventListener(
+ DISTRACTION_FREE_DISABLE_EVENT_NAME,
+ () => {
+ doc.body.removeEventListener('keydown', handleKeyPress, false);
+ },
+ false,
+ );
+})(window, window.document);
diff --git a/src/bundle/Resources/public/js/scripts/admin.focus.mode.js b/src/bundle/Resources/public/js/scripts/admin.focus.mode.js
index b532d3a2b7..d9927c81ac 100644
--- a/src/bundle/Resources/public/js/scripts/admin.focus.mode.js
+++ b/src/bundle/Resources/public/js/scripts/admin.focus.mode.js
@@ -1,65 +1,12 @@
(function (global, doc) {
- let activeFieldEdit = null;
- const FOCUS_MODE_ENABLE_EVENT_NAME = 'ibexa-focus-mode:enable';
- const FOCUS_MODE_DISABLE_EVENT_NAME = 'ibexa-focus-mode:disable';
- const focusModeEnableBtns = doc.querySelectorAll('.ibexa-field-edit__focus-mode-control-btn--enable');
- const focusModeDisbaleBtns = doc.querySelectorAll('.ibexa-field-edit__focus-mode-control-btn--disable');
- const changeFocusModeState = (active) => {
- if (!activeFieldEdit) {
- return;
- }
-
- const dispatchEventName = active ? FOCUS_MODE_ENABLE_EVENT_NAME : FOCUS_MODE_DISABLE_EVENT_NAME;
- const editorSourceElement = activeFieldEdit.querySelector('.ibexa-data-source__richtext');
- const editorInstance = editorSourceElement.ckeditorInstance;
-
- activeFieldEdit.classList.toggle('ibexa-field-edit--focus-mode-active', active);
- editorInstance.set('focusModeActive', active);
-
- doc.body.dispatchEvent(
- new CustomEvent(dispatchEventName, {
- detail: {
- activeFieldEdit,
- },
- }),
- );
-
- if (!active) {
- activeFieldEdit = null;
- }
- };
- const handleKeyPress = (event) => {
- if (event.key === 'Escape') {
- changeFocusModeState(false);
- }
- };
-
- focusModeEnableBtns.forEach((btn) => {
- btn.addEventListener(
- 'click',
- ({ currentTarget }) => {
- activeFieldEdit = currentTarget.closest('.ibexa-field-edit');
- changeFocusModeState(true);
- },
- false,
- );
- });
- focusModeDisbaleBtns.forEach((btn) => {
- btn.addEventListener('click', () => changeFocusModeState(false), false);
- });
-
- doc.body.addEventListener(
- FOCUS_MODE_ENABLE_EVENT_NAME,
- () => {
- doc.body.addEventListener('keydown', handleKeyPress, false);
- },
- false,
- );
- doc.body.addEventListener(
- FOCUS_MODE_DISABLE_EVENT_NAME,
- () => {
- doc.body.removeEventListener('keydown', handleKeyPress, false);
- },
- false,
- );
+ const FORM_SELECTOR = 'form[name=focus_mode_change]';
+ const form = doc.querySelector(FORM_SELECTOR);
+
+ if (form) {
+ form.querySelectorAll('input[type=checkbox]').forEach((input) => {
+ input.addEventListener('change', () => {
+ form.submit();
+ });
+ });
+ }
})(window, window.document);
diff --git a/src/bundle/Resources/public/js/scripts/admin.user.mode.js b/src/bundle/Resources/public/js/scripts/admin.user.mode.js
deleted file mode 100644
index 65be41b779..0000000000
--- a/src/bundle/Resources/public/js/scripts/admin.user.mode.js
+++ /dev/null
@@ -1,12 +0,0 @@
-(function (global, doc) {
- const FORM_SELECTOR = 'form[name=user_mode_change]';
- const form = doc.querySelector(FORM_SELECTOR);
-
- if (form) {
- form.querySelectorAll('input[type=checkbox]').forEach((input) => {
- input.addEventListener('change', () => {
- form.submit();
- });
- });
- }
-})(window, window.document);
diff --git a/src/bundle/Resources/public/scss/fieldType/edit/_base-field.scss b/src/bundle/Resources/public/scss/fieldType/edit/_base-field.scss
index c8c1adfba8..31f3982f5d 100644
--- a/src/bundle/Resources/public/scss/fieldType/edit/_base-field.scss
+++ b/src/bundle/Resources/public/scss/fieldType/edit/_base-field.scss
@@ -15,7 +15,7 @@
color: $ibexa-color-danger;
}
- &__focus-mode {
+ &__distraction-free-mode {
display: flex;
flex-direction: column;
height: auto;
@@ -23,11 +23,11 @@
border-radius: $ibexa-border-radius $ibexa-border-radius 0 0;
}
- &__focus-mode-notice-container {
+ &__distraction-free-mode-notice-container {
display: none;
}
- &__focus-mode-control-container {
+ &__distraction-free-mode-control-container {
display: flex;
align-self: flex-end;
@@ -36,7 +36,7 @@
}
}
- &__focus-mode-control-btn {
+ &__distraction-free-mode-control-btn {
align-self: flex-end;
&--enable {
@@ -93,31 +93,28 @@
}
}
- &--has-focus-mode {
+ &--has-distraction-free-mode {
display: flex;
flex-wrap: wrap;
.ibexa-field-edit {
- &__focus-mode {
+ &__distraction-free-mode {
margin: auto 0 0;
align-self: baseline;
+ width: 20%;
}
&__label-wrapper {
width: 80%;
}
- &__focus-mode {
- width: 20%;
- }
-
&__data {
width: 100%;
}
}
}
- &--focus-mode-active {
+ &--distraction-free-mode-active {
position: fixed;
top: 0;
left: 0;
@@ -133,18 +130,18 @@
display: none;
}
- &__focus-mode {
+ &__distraction-free-mode {
width: 100%;
height: fit-content;
padding: calculateRem(32px) calculateRem(32px) 0 calculateRem(32px);
}
- &__focus-mode-notice-container {
+ &__distraction-free-mode-notice-container {
display: block;
width: 100%;
}
- &__focus-mode-control-container {
+ &__distraction-free-mode-control-container {
display: flex;
justify-content: space-between;
width: 100%;
@@ -156,7 +153,7 @@
}
}
- &__focus-mode-control-btn {
+ &__distraction-free-mode-control-btn {
margin: 0;
&--enable {
@@ -188,7 +185,7 @@
}
}
- &--focus-mode-active.is-invalid {
+ &--distraction-free-mode-active.is-invalid {
.ibexa-field-edit {
&__data {
border-radius: 0;
diff --git a/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff b/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff
index 74248ee60f..053eb6b721 100644
--- a/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff
+++ b/src/bundle/Resources/translations/ibexa_admin_ui.en.xliff
@@ -11,6 +11,31 @@
Expert mode – Tailored for experienced users familiar with Ibexa DXP. Provides comprehensive insights into the technical aspects of Content structure, including:
+Focus mode: off – Tailored for experienced users familiar with Ibexa DXP. + Provides comprehensive insights into the technical aspects of Content structure, including: