Skip to content

Commit 672db6c

Browse files
juanjofgliferaybrianchandotcom
authored andcommitted
LPD-52469 - Feat. Add CKEditor5 config contributor to setup sticky toolbar offset
1 parent 1768d5f commit 672db6c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* SPDX-FileCopyrightText: (c) 2025 Liferay, Inc. https://liferay.com
3+
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
4+
*/
5+
6+
package com.liferay.journal.web.internal.editor.configuration;
7+
8+
import com.liferay.journal.constants.JournalPortletKeys;
9+
import com.liferay.portal.kernel.editor.configuration.BaseEditorConfigContributor;
10+
import com.liferay.portal.kernel.editor.configuration.EditorConfigContributor;
11+
import com.liferay.portal.kernel.json.JSONObject;
12+
import com.liferay.portal.kernel.json.JSONUtil;
13+
import com.liferay.portal.kernel.portlet.RequestBackedPortletURLFactory;
14+
import com.liferay.portal.kernel.theme.ThemeDisplay;
15+
16+
import java.util.Map;
17+
18+
import org.osgi.service.component.annotations.Component;
19+
20+
/**
21+
* @author Juanjo Fernández
22+
*/
23+
@Component(
24+
property = {
25+
"editor.config.key=rich_text", "editor.name=ckeditor5_classic",
26+
"javax.portlet.name=" + JournalPortletKeys.JOURNAL
27+
},
28+
service = EditorConfigContributor.class
29+
)
30+
public class JournalArticleContentCKEditor5ConfigContributor
31+
extends BaseEditorConfigContributor {
32+
33+
@Override
34+
public void populateConfigJSONObject(
35+
JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes,
36+
ThemeDisplay themeDisplay,
37+
RequestBackedPortletURLFactory requestBackedPortletURLFactory) {
38+
39+
jsonObject.put(
40+
"ui", JSONUtil.put("viewportOffset", JSONUtil.put("top", 120)));
41+
}
42+
43+
}

0 commit comments

Comments
 (0)