Skip to content

Commit

Permalink
feat: Implement edit note publication schedule - EXO-75389 - Meeds-io…
Browse files Browse the repository at this point in the history
…/MIPs#161 (#1214)

Implement edit note publication schedule
  • Loading branch information
hakermi committed Nov 26, 2024
1 parent 3c8f139 commit 429483f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 41 deletions.
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 @@ -6,6 +6,5 @@
%>

<script type="text/javascript" id="NoteHeadScripts">
eXo.env.portal.insertImageOptionEnabled = <%=featureService.isFeatureActiveForUser("insertImage", userName)%>;
eXo.env.portal.notePublicationEnabled = <%=featureService.isFeatureActiveForUser("notePublication", userName)%>;
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
:publish="publicationSettings?.publish"
:is-publishing="isPublishing"
:edit-mode="editMode"
:from-external-page="noteObject?.fromExternalPage"
:saved-schedule-settings="{
scheduled: currentScheduleSettings?.schedule,
postDate: currentScheduleSettings?.postDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,19 @@
</template>
<script>
const SCHEDULE_OPTION = 'schedule';
const PUBLISH_NOW_OPTION = 'publish_now';
const CANCEL_SCHEDULE_OPTION = 'cancel_schedule';
const CANCEL_PUBLICATION_OPTION = 'cancel_unpublish';
export const SCHEDULE_OPTION = 'schedule';
export const PUBLISH_NOW_OPTION = 'publish_now';
export const CANCEL_SCHEDULE_OPTION = 'cancel_schedule';
export const CANCEL_PUBLICATION_OPTION = 'cancel_unpublish';
export default {
data() {
const { startDate, minStartDate, endDate } = this.initDateValues();
const betweenScheduleType = {label: this.$t('notes.publication.schedule.between.label'), value: 'between'};
const untilScheduleType = {label: this.$t('notes.publication.schedule.until.label'), value: 'until'};
const fromScheduleType = {label: this.$t('notes.publication.schedule.from.label'), value: 'from'};
return {
CANCEL_SCHEDULE_OPTION,
CANCEL_PUBLICATION_OPTION,
editScheduleOption: null,
schedule: false,
betweenScheduleType: betweenScheduleType,
Expand Down Expand Up @@ -266,6 +268,10 @@ export default {
canPublish: {
type: Boolean,
default: false
},
fromExternalPage: {
type: Boolean,
default: false
}
},
watch: {
Expand Down Expand Up @@ -307,10 +313,6 @@ export default {
isMultipleSelectionOption() {
return this.schedule && this.isUntilScheduleType && !this.hasSavedUnpublishSchedule;
},
cancelOption() {
return this.hasSavedUnpublishSchedule && {label: this.$t('notes.publication.publish.cancel.label'), value: CANCEL_PUBLICATION_OPTION}
|| {label: this.$t('notes.publication.schedule.cancel.label'), value: CANCEL_SCHEDULE_OPTION};
},
formattedStartDate() {
return this.startDate && this.formatDate(this.startDate) || '';
},
Expand Down
30 changes: 0 additions & 30 deletions notes-webapp/src/main/webapp/vue-app/notes-rich-editor/js/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,33 +155,3 @@ export function isSameContent(content, originalContent) {
function getString(body) {
return new DOMParser().parseFromString(body, 'text/html').documentElement.textContent.replace(/&nbsp;/g, '').trim();
}

export function sanitizeSrcImageTags(content) {
if (!content) {
return content;
}
const regex = /(<img[^>]*?)(\s+src="data:image\/[^;]+;base64,[^"]*")/g;
content = content.replace(regex, '$1');
return content;
}

export function isHasImagesToBeProcessed(htmlStringContent, objectType) {
// Parse the HTML content
const parser = new DOMParser();
const document = parser.parseFromString(htmlStringContent, 'text/html');

const imgTags = document.querySelectorAll('img');
const prefix = '/portal/rest/v1/social/attachments/';

for (const imgTag of imgTags) {
const src = imgTag.getAttribute('src');
if (src?.startsWith?.(prefix)) {
const srcPart = src.substring(prefix.length);
const sourceObject = srcPart.substring(0, srcPart.indexOf('/'));
if (sourceObject !== objectType) {
return true;
}
}
}
return htmlStringContent.includes('cke_upload_id=');
}

0 comments on commit 429483f

Please sign in to comment.