Skip to content

Commit

Permalink
feat: Remove insert image feature flag - EXO-75970 - Meeds-io/MIPs#145 (
Browse files Browse the repository at this point in the history
  • Loading branch information
sofyenne committed Dec 13, 2024
1 parent 04291ab commit 3abfbfa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 39 deletions.
23 changes: 4 additions & 19 deletions notes-webapp/src/main/webapp/WEB-INF/conf/wiki/ckeditor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ CKEDITOR.editorConfig = function (config) {
}
CKEDITOR.plugins.addExternal('toc','/notes/javascript/eXo/wiki/ckeditor/plugins/toc/','plugin.js');
CKEDITOR.plugins.addExternal('linkBalloon', '/social/js/ckeditorPlugins/linkBalloon/', 'plugin.js');
if (eXo.env.portal.insertImageOptionEnabled) {
CKEDITOR.plugins.addExternal('insertImage','/notes/javascript/eXo/wiki/ckeditor/plugins/insertImage/','plugin.js');
}
CKEDITOR.plugins.addExternal('insertImage','/notes/javascript/eXo/wiki/ckeditor/plugins/insertImage/','plugin.js');

let blocksToolbarGroup = [
const blocksToolbarGroup = [
'Blockquote',
'tagSuggester',
'emoji',
`${eXo.env.portal.insertImageOptionEnabled && 'insertImage' || 'selectImage'}`,
'insertImage',
'Table',
'EmbedSemantic',
'CodeSnippet',
Expand Down Expand Up @@ -79,23 +77,10 @@ CKEDITOR.editorConfig = function (config) {
if (!webPageNote) {
mobileToolbar[mobileToolbar.findIndex(item => item.name ==='blocks')].items.push('attachFile');
}
let extraPlugins = `a11ychecker,balloonpanel,indent,indentblock,indentlist,codesnippet,sharedspace,copyformatting,table,tabletools,embedsemantic,autolink,colordialog${!webPageNote && ',tagSuggester' || ''},emoji,link,font,justify,widget,${!webPageNote && ',insertOptions' || ''},contextmenu,tabletools,tableresize,toc,linkBalloon,suggester,${eXo.env.portal.insertImageOptionEnabled && 'image2,insertImage' || ''}`;
let extraPlugins = `a11ychecker,balloonpanel,indent,indentblock,indentlist,codesnippet,sharedspace,copyformatting,table,tabletools,embedsemantic,autolink,colordialog${!webPageNote && ',tagSuggester' || ''},emoji,link,font,justify,widget,${!webPageNote && ',insertOptions' || ''},contextmenu,tabletools,tableresize,toc,linkBalloon,suggester,image2,insertImage`;
let removePlugins = `image,confirmBeforeReload,maximize,resize,autoembed${webPageNote && ',tagSuggester' || ''}`;

require(['SHARED/extensionRegistry'], function(extensionRegistry) {
if (!eXo.env.portal.insertImageOptionEnabled) {
const ckEditorExtensions = extensionRegistry.loadExtensions('WYSIWYGPlugins', 'image');
if (ckEditorExtensions?.length) {
const ckEditorExtraPlugins = ckEditorExtensions.map(ckEditorExtension => ckEditorExtension.extraPlugin).join(',');
const ckEditorRemovePlugins = ckEditorExtensions.map(ckEditorExtension => ckEditorExtension.removePlugin).join(',');
if (ckEditorExtraPlugins) {
extraPlugins = `${extraPlugins},${ckEditorExtraPlugins}`;
}
if (ckEditorRemovePlugins) {
removePlugins = `${removePlugins},${ckEditorRemovePlugins}`;
}
}
}
const notesEditorExtensions = extensionRegistry.loadExtensions('NotesEditor', 'ckeditor-extensions');
if (notesEditorExtensions?.length) {
notesEditorExtensions.forEach(notesEditorExtension => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,15 @@ CKEDITOR.editorConfig = function (config) {
CKEDITOR.plugins.addExternal('insertOptions','/notes/javascript/eXo/wiki/ckeditor/plugins/insertOptions/','plugin.js');
CKEDITOR.plugins.addExternal('toc','/notes/javascript/eXo/wiki/ckeditor/plugins/toc/','plugin.js');
CKEDITOR.plugins.addExternal('linkBalloon', '/social/js/ckeditorPlugins/linkBalloon/', 'plugin.js');
if (eXo.env.portal.insertImageOptionEnabled) {
CKEDITOR.plugins.addExternal('insertImage','/notes/javascript/eXo/wiki/ckeditor/plugins/insertImage/','plugin.js');
}
CKEDITOR.plugins.addExternal('insertImage','/notes/javascript/eXo/wiki/ckeditor/plugins/insertImage/','plugin.js');


let extraPlugins = 'simpleLink,a11ychecker,balloonpanel,indent,indentblock,indentlist,codesnippet,sharedspace,copyformatting,table,tabletools,embedsemantic,' +
`autolink,colordialog,emoji,link,font,justify,widget,insertOptions,contextmenu,tabletools,tableresize,toc,editorplaceholder,formatOption,linkBalloon,${eXo.env.portal.insertImageOptionEnabled && 'image2,insertImage' || ''}`;
'autolink,colordialog,emoji,link,font,justify,widget,insertOptions,contextmenu,tabletools,tableresize,toc,editorplaceholder,formatOption,linkBalloon,image2,insertImage';

let removePlugins = 'image,confirmBeforeReload,maximize,resize,autoembed,tagSuggester,attachImage';

require(['SHARED/extensionRegistry'], function(extensionRegistry) {
if (!eXo.env.portal.insertImageOptionEnabled) {
const ckEditorExtensions = extensionRegistry.loadExtensions('WYSIWYGPlugins', 'image');
if (ckEditorExtensions?.length) {
const ckEditorExtraPlugins = ckEditorExtensions.map(ckEditorExtension => ckEditorExtension.extraPlugin).join(',');
const ckEditorRemovePlugins = ckEditorExtensions.map(ckEditorExtension => ckEditorExtension.removePlugin).join(',');
if (ckEditorExtraPlugins) {
extraPlugins = `${extraPlugins},${ckEditorExtraPlugins}`;
}
if (ckEditorRemovePlugins) {
removePlugins = `${removePlugins},${ckEditorRemovePlugins}`;
}
}
}
const notesEditorExtensions = extensionRegistry.loadExtensions('NotesEditor', 'ckeditor-extensions');
if (notesEditorExtensions?.length) {
notesEditorExtensions.forEach(notesEditorExtension => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
<properties-param>
<name>NoteFeatureProperties</name>
<description>Note Feature enablement flag</description>
<property name="exo.feature.insertImage.enabled"
value="${exo.feature.insertImage.enabled:false}"/>
<property name="exo.feature.notePublication.enabled"
value="${exo.feature.notePublication.enabled:false}"/>
</properties-param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

<script type="text/javascript" id="NoteHeadScripts">
eXo.env.portal.notePublicationEnabled = <%=featureService.isFeatureActiveForUser("notePublication", userName)%>;
eXo.env.portal.insertImageOptionEnabled = <%=featureService.isFeatureActiveForUser("insertImage", userName)%>;
</script>

0 comments on commit 3abfbfa

Please sign in to comment.