From 96c862260851852dc02b44f17177b75681bcc4a0 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 28 Jan 2020 12:52:56 +0100 Subject: [PATCH] MOBILE-3323 editor: Create new folder editor in src/core --- .../pages/edit-event/edit-event.module.ts | 2 + .../calendar/pages/edit-event/edit-event.ts | 4 +- .../feedback/comments/comments.module.ts | 4 +- .../onlinetext/onlinetext.module.ts | 4 +- src/addon/mod/data/fields/field.module.ts | 2 +- .../data/fields/textarea/textarea.module.ts | 4 +- .../mod/forum/components/components.module.ts | 4 +- .../forum/pages/edit-post/edit-post.module.ts | 2 + .../new-discussion/new-discussion.module.ts | 2 + .../pages/new-discussion/new-discussion.ts | 4 +- .../mod/glossary/pages/edit/edit.module.ts | 2 + .../mod/lesson/pages/player/player.module.ts | 2 + src/addon/mod/wiki/pages/edit/edit.module.ts | 2 + .../workshop/components/components.module.ts | 4 +- .../pages/assessment/assessment.module.ts | 2 + .../edit-submission/edit-submission.module.ts | 2 + .../pages/submission/submission.module.ts | 2 + src/addon/qtype/essay/essay.module.ts | 4 +- .../textarea/textarea.module.ts | 4 +- src/app/app.module.ts | 2 + src/components/components.module.ts | 3 -- .../editor/components/components.module.ts | 41 +++++++++++++++++++ .../core-editor-rich-text-editor.html} | 0 .../rich-text-editor/rich-text-editor.scss | 0 .../rich-text-editor/rich-text-editor.ts | 14 ++----- src/core/editor/editor.module.ts | 27 ++++++++++++ 26 files changed, 118 insertions(+), 25 deletions(-) create mode 100644 src/core/editor/components/components.module.ts rename src/{components/rich-text-editor/core-rich-text-editor.html => core/editor/components/rich-text-editor/core-editor-rich-text-editor.html} (100%) rename src/{ => core/editor}/components/rich-text-editor/rich-text-editor.scss (100%) rename src/{ => core/editor}/components/rich-text-editor/rich-text-editor.ts (97%) create mode 100644 src/core/editor/editor.module.ts diff --git a/src/addon/calendar/pages/edit-event/edit-event.module.ts b/src/addon/calendar/pages/edit-event/edit-event.module.ts index 32a1ac65a..5821de8a0 100644 --- a/src/addon/calendar/pages/edit-event/edit-event.module.ts +++ b/src/addon/calendar/pages/edit-event/edit-event.module.ts @@ -17,6 +17,7 @@ import { IonicPageModule } from 'ionic-angular'; import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; import { AddonCalendarEditEventPage } from './edit-event'; @NgModule({ @@ -26,6 +27,7 @@ import { AddonCalendarEditEventPage } from './edit-event'; imports: [ CoreComponentsModule, CoreDirectivesModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonCalendarEditEventPage), TranslateModule.forChild() ], diff --git a/src/addon/calendar/pages/edit-event/edit-event.ts b/src/addon/calendar/pages/edit-event/edit-event.ts index 293d1fd62..16f9350ce 100644 --- a/src/addon/calendar/pages/edit-event/edit-event.ts +++ b/src/addon/calendar/pages/edit-event/edit-event.ts @@ -25,7 +25,7 @@ import { CoreTimeUtilsProvider } from '@providers/utils/time'; import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreCoursesProvider } from '@core/courses/providers/courses'; import { CoreSplitViewComponent } from '@components/split-view/split-view'; -import { CoreRichTextEditorComponent } from '@components/rich-text-editor/rich-text-editor.ts'; +import { CoreEditorRichTextEditorComponent } from '@core/editor/components/rich-text-editor/rich-text-editor.ts'; import { AddonCalendarProvider, AddonCalendarGetAccessInfoResult, AddonCalendarEvent } from '../../providers/calendar'; import { AddonCalendarOfflineProvider } from '../../providers/calendar-offline'; import { AddonCalendarHelperProvider } from '../../providers/helper'; @@ -43,7 +43,7 @@ import { CoreFilterHelperProvider } from '@core/filter/providers/helper'; }) export class AddonCalendarEditEventPage implements OnInit, OnDestroy { - @ViewChild(CoreRichTextEditorComponent) descriptionEditor: CoreRichTextEditorComponent; + @ViewChild(CoreEditorRichTextEditorComponent) descriptionEditor: CoreEditorRichTextEditorComponent; title: string; dateFormat: string; diff --git a/src/addon/mod/assign/feedback/comments/comments.module.ts b/src/addon/mod/assign/feedback/comments/comments.module.ts index 491a88fde..cb23c6983 100644 --- a/src/addon/mod/assign/feedback/comments/comments.module.ts +++ b/src/addon/mod/assign/feedback/comments/comments.module.ts @@ -21,6 +21,7 @@ import { AddonModAssignFeedbackCommentsComponent } from './component/comments'; import { AddonModAssignFeedbackDelegate } from '../../providers/feedback-delegate'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -31,7 +32,8 @@ import { CoreDirectivesModule } from '@directives/directives.module'; IonicModule, TranslateModule.forChild(), CoreComponentsModule, - CoreDirectivesModule + CoreDirectivesModule, + CoreEditorComponentsModule, ], providers: [ AddonModAssignFeedbackCommentsHandler diff --git a/src/addon/mod/assign/submission/onlinetext/onlinetext.module.ts b/src/addon/mod/assign/submission/onlinetext/onlinetext.module.ts index 88de4de1d..5ac1e16f8 100644 --- a/src/addon/mod/assign/submission/onlinetext/onlinetext.module.ts +++ b/src/addon/mod/assign/submission/onlinetext/onlinetext.module.ts @@ -21,6 +21,7 @@ import { AddonModAssignSubmissionOnlineTextComponent } from './component/onlinet import { AddonModAssignSubmissionDelegate } from '../../providers/submission-delegate'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -31,7 +32,8 @@ import { CoreDirectivesModule } from '@directives/directives.module'; IonicModule, TranslateModule.forChild(), CoreComponentsModule, - CoreDirectivesModule + CoreDirectivesModule, + CoreEditorComponentsModule, ], providers: [ AddonModAssignSubmissionOnlineTextHandler diff --git a/src/addon/mod/data/fields/field.module.ts b/src/addon/mod/data/fields/field.module.ts index 0e0467799..9a850d4f6 100644 --- a/src/addon/mod/data/fields/field.module.ts +++ b/src/addon/mod/data/fields/field.module.ts @@ -40,7 +40,7 @@ import { AddonModDataFieldUrlModule } from './url/url.module'; AddonModDataFieldRadiobuttonModule, AddonModDataFieldTextModule, AddonModDataFieldTextareaModule, - AddonModDataFieldUrlModule + AddonModDataFieldUrlModule, ], providers: [ ], diff --git a/src/addon/mod/data/fields/textarea/textarea.module.ts b/src/addon/mod/data/fields/textarea/textarea.module.ts index 3f7070ef7..ead1184b6 100644 --- a/src/addon/mod/data/fields/textarea/textarea.module.ts +++ b/src/addon/mod/data/fields/textarea/textarea.module.ts @@ -20,6 +20,7 @@ import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate'; import { AddonModDataFieldTextareaComponent } from './component/textarea'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -30,7 +31,8 @@ import { CoreDirectivesModule } from '@directives/directives.module'; IonicModule, TranslateModule.forChild(), CoreComponentsModule, - CoreDirectivesModule + CoreDirectivesModule, + CoreEditorComponentsModule, ], providers: [ AddonModDataFieldTextareaHandler diff --git a/src/addon/mod/forum/components/components.module.ts b/src/addon/mod/forum/components/components.module.ts index 5a3180af3..e9cdcba14 100644 --- a/src/addon/mod/forum/components/components.module.ts +++ b/src/addon/mod/forum/components/components.module.ts @@ -26,6 +26,7 @@ import { AddonModForumIndexComponent } from './index/index'; import { AddonModForumPostComponent } from './post/post'; import { AddonForumDiscussionOptionsMenuComponent } from './discussion-options-menu/discussion-options-menu'; import { AddonForumPostOptionsMenuComponent } from './post-options-menu/post-options-menu'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -43,7 +44,8 @@ import { AddonForumPostOptionsMenuComponent } from './post-options-menu/post-opt CorePipesModule, CoreCourseComponentsModule, CoreRatingComponentsModule, - CoreTagComponentsModule + CoreTagComponentsModule, + CoreEditorComponentsModule, ], providers: [ ], diff --git a/src/addon/mod/forum/pages/edit-post/edit-post.module.ts b/src/addon/mod/forum/pages/edit-post/edit-post.module.ts index 07f409742..89cf9ad4d 100644 --- a/src/addon/mod/forum/pages/edit-post/edit-post.module.ts +++ b/src/addon/mod/forum/pages/edit-post/edit-post.module.ts @@ -19,6 +19,7 @@ import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModForumComponentsModule } from '../../components/components.module'; import { AddonModForumEditPostPage } from './edit-post'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -28,6 +29,7 @@ import { AddonModForumEditPostPage } from './edit-post'; CoreComponentsModule, CoreDirectivesModule, AddonModForumComponentsModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModForumEditPostPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/forum/pages/new-discussion/new-discussion.module.ts b/src/addon/mod/forum/pages/new-discussion/new-discussion.module.ts index c0add2f4c..0bb9e4038 100644 --- a/src/addon/mod/forum/pages/new-discussion/new-discussion.module.ts +++ b/src/addon/mod/forum/pages/new-discussion/new-discussion.module.ts @@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModForumNewDiscussionPage } from './new-discussion'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -26,6 +27,7 @@ import { AddonModForumNewDiscussionPage } from './new-discussion'; imports: [ CoreComponentsModule, CoreDirectivesModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModForumNewDiscussionPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts index 091753865..68b44837b 100644 --- a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts +++ b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts @@ -25,7 +25,7 @@ import { CoreTextUtilsProvider } from '@providers/utils/text'; import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreFileUploaderProvider } from '@core/fileuploader/providers/fileuploader'; import { CoreSplitViewComponent } from '@components/split-view/split-view'; -import { CoreRichTextEditorComponent } from '@components/rich-text-editor/rich-text-editor.ts'; +import { CoreEditorRichTextEditorComponent } from '@core/editor/components/rich-text-editor/rich-text-editor.ts'; import { AddonModForumProvider } from '../../providers/forum'; import { AddonModForumOfflineProvider } from '../../providers/offline'; import { AddonModForumHelperProvider } from '../../providers/helper'; @@ -41,7 +41,7 @@ import { AddonModForumSyncProvider } from '../../providers/sync'; }) export class AddonModForumNewDiscussionPage implements OnDestroy { - @ViewChild(CoreRichTextEditorComponent) messageEditor: CoreRichTextEditorComponent; + @ViewChild(CoreEditorRichTextEditorComponent) messageEditor: CoreEditorRichTextEditorComponent; component = AddonModForumProvider.COMPONENT; messageControl = new FormControl(); diff --git a/src/addon/mod/glossary/pages/edit/edit.module.ts b/src/addon/mod/glossary/pages/edit/edit.module.ts index 0f606e93e..926f32ad6 100644 --- a/src/addon/mod/glossary/pages/edit/edit.module.ts +++ b/src/addon/mod/glossary/pages/edit/edit.module.ts @@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModGlossaryEditPage } from './edit'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -26,6 +27,7 @@ import { AddonModGlossaryEditPage } from './edit'; imports: [ CoreComponentsModule, CoreDirectivesModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModGlossaryEditPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/lesson/pages/player/player.module.ts b/src/addon/mod/lesson/pages/player/player.module.ts index 361ae19ab..c6dd35097 100644 --- a/src/addon/mod/lesson/pages/player/player.module.ts +++ b/src/addon/mod/lesson/pages/player/player.module.ts @@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModLessonPlayerPage } from './player'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -26,6 +27,7 @@ import { AddonModLessonPlayerPage } from './player'; imports: [ CoreComponentsModule, CoreDirectivesModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModLessonPlayerPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/wiki/pages/edit/edit.module.ts b/src/addon/mod/wiki/pages/edit/edit.module.ts index 20b25f6bc..ecf4b0fa4 100644 --- a/src/addon/mod/wiki/pages/edit/edit.module.ts +++ b/src/addon/mod/wiki/pages/edit/edit.module.ts @@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModWikiEditPage } from './edit'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -26,6 +27,7 @@ import { AddonModWikiEditPage } from './edit'; imports: [ CoreComponentsModule, CoreDirectivesModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModWikiEditPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/workshop/components/components.module.ts b/src/addon/mod/workshop/components/components.module.ts index 775490396..279484ef6 100644 --- a/src/addon/mod/workshop/components/components.module.ts +++ b/src/addon/mod/workshop/components/components.module.ts @@ -24,6 +24,7 @@ import { AddonModWorkshopIndexComponent } from './index/index'; import { AddonModWorkshopSubmissionComponent } from './submission/submission'; import { AddonModWorkshopAssessmentComponent } from './assessment/assessment'; import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strategy/assessment-strategy'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -39,7 +40,8 @@ import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strate CoreComponentsModule, CoreDirectivesModule, CorePipesModule, - CoreCourseComponentsModule + CoreCourseComponentsModule, + CoreEditorComponentsModule, ], providers: [ ], diff --git a/src/addon/mod/workshop/pages/assessment/assessment.module.ts b/src/addon/mod/workshop/pages/assessment/assessment.module.ts index 21415631e..8a2314b34 100644 --- a/src/addon/mod/workshop/pages/assessment/assessment.module.ts +++ b/src/addon/mod/workshop/pages/assessment/assessment.module.ts @@ -19,6 +19,7 @@ import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModWorkshopComponentsModule } from '../../components/components.module'; import { AddonModWorkshopAssessmentPage } from './assessment'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -28,6 +29,7 @@ import { AddonModWorkshopAssessmentPage } from './assessment'; CoreDirectivesModule, CoreComponentsModule, AddonModWorkshopComponentsModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModWorkshopAssessmentPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/workshop/pages/edit-submission/edit-submission.module.ts b/src/addon/mod/workshop/pages/edit-submission/edit-submission.module.ts index 25e5e4073..d3b216c60 100644 --- a/src/addon/mod/workshop/pages/edit-submission/edit-submission.module.ts +++ b/src/addon/mod/workshop/pages/edit-submission/edit-submission.module.ts @@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModWorkshopEditSubmissionPage } from './edit-submission'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -26,6 +27,7 @@ import { AddonModWorkshopEditSubmissionPage } from './edit-submission'; imports: [ CoreDirectivesModule, CoreComponentsModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModWorkshopEditSubmissionPage), TranslateModule.forChild() ], diff --git a/src/addon/mod/workshop/pages/submission/submission.module.ts b/src/addon/mod/workshop/pages/submission/submission.module.ts index b393b059b..6484fdc06 100644 --- a/src/addon/mod/workshop/pages/submission/submission.module.ts +++ b/src/addon/mod/workshop/pages/submission/submission.module.ts @@ -19,6 +19,7 @@ import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonModWorkshopComponentsModule } from '../../components/components.module'; import { AddonModWorkshopSubmissionPage } from './submission'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -28,6 +29,7 @@ import { AddonModWorkshopSubmissionPage } from './submission'; CoreDirectivesModule, CoreComponentsModule, AddonModWorkshopComponentsModule, + CoreEditorComponentsModule, IonicPageModule.forChild(AddonModWorkshopSubmissionPage), TranslateModule.forChild() ], diff --git a/src/addon/qtype/essay/essay.module.ts b/src/addon/qtype/essay/essay.module.ts index da95a1363..d259137cc 100644 --- a/src/addon/qtype/essay/essay.module.ts +++ b/src/addon/qtype/essay/essay.module.ts @@ -20,6 +20,7 @@ import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { AddonQtypeEssayHandler } from './providers/handler'; import { AddonQtypeEssayComponent } from './component/essay'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -29,7 +30,8 @@ import { AddonQtypeEssayComponent } from './component/essay'; IonicModule, TranslateModule.forChild(), CoreComponentsModule, - CoreDirectivesModule + CoreDirectivesModule, + CoreEditorComponentsModule, ], providers: [ AddonQtypeEssayHandler diff --git a/src/addon/userprofilefield/textarea/textarea.module.ts b/src/addon/userprofilefield/textarea/textarea.module.ts index f64fc285d..68ad0e678 100644 --- a/src/addon/userprofilefield/textarea/textarea.module.ts +++ b/src/addon/userprofilefield/textarea/textarea.module.ts @@ -20,6 +20,7 @@ import { CoreUserProfileFieldDelegate } from '@core/user/providers/user-profile- import { AddonUserProfileFieldTextareaComponent } from './component/textarea'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; +import { CoreEditorComponentsModule } from '@core/editor/components/components.module'; @NgModule({ declarations: [ @@ -29,7 +30,8 @@ import { CoreDirectivesModule } from '@directives/directives.module'; IonicModule, TranslateModule.forChild(), CoreComponentsModule, - CoreDirectivesModule + CoreDirectivesModule, + CoreEditorComponentsModule, ], providers: [ AddonUserProfileFieldTextareaHandler diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 38fff7b5d..81fdb84a7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -87,6 +87,7 @@ import { CoreTagModule } from '@core/tag/tag.module'; import { CoreFilterModule } from '@core/filter/filter.module'; import { CoreH5PModule } from '@core/h5p/h5p.module'; import { CoreSearchModule } from '@core/search/search.module'; +import { CoreEditorModule } from '@core/editor/editor.module'; // Addon modules. import { AddonBadgesModule } from '@addon/badges/badges.module'; @@ -235,6 +236,7 @@ export const WP_PROVIDER: any = null; CoreFilterModule, CoreH5PModule, CoreSearchModule, + CoreEditorModule, AddonBadgesModule, AddonBlogModule, AddonCalendarModule, diff --git a/src/components/components.module.ts b/src/components/components.module.ts index bdd2f6d4c..e48f29dd6 100644 --- a/src/components/components.module.ts +++ b/src/components/components.module.ts @@ -39,7 +39,6 @@ import { CoreLocalFileComponent } from './local-file/local-file'; import { CoreSitePickerComponent } from './site-picker/site-picker'; import { CoreTabsComponent } from './tabs/tabs'; import { CoreTabComponent } from './tabs/tab'; -import { CoreRichTextEditorComponent } from './rich-text-editor/rich-text-editor'; import { CoreNavBarButtonsComponent } from './navbar-buttons/navbar-buttons'; import { CoreDynamicComponent } from './dynamic-component/dynamic-component'; import { CoreSendMessageFormComponent } from './send-message-form/send-message-form'; @@ -79,7 +78,6 @@ import { CoreBSTooltipComponent } from './bs-tooltip/bs-tooltip'; CoreSitePickerComponent, CoreTabsComponent, CoreTabComponent, - CoreRichTextEditorComponent, CoreNavBarButtonsComponent, CoreDynamicComponent, CoreSendMessageFormComponent, @@ -128,7 +126,6 @@ import { CoreBSTooltipComponent } from './bs-tooltip/bs-tooltip'; CoreSitePickerComponent, CoreTabsComponent, CoreTabComponent, - CoreRichTextEditorComponent, CoreNavBarButtonsComponent, CoreDynamicComponent, CoreSendMessageFormComponent, diff --git a/src/core/editor/components/components.module.ts b/src/core/editor/components/components.module.ts new file mode 100644 index 000000000..5d8edf3e7 --- /dev/null +++ b/src/core/editor/components/components.module.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { IonicModule } from 'ionic-angular'; +import { TranslateModule } from '@ngx-translate/core'; +import { CoreEditorRichTextEditorComponent } from './rich-text-editor/rich-text-editor'; +import { CoreComponentsModule } from '@components/components.module'; + +@NgModule({ + declarations: [ + CoreEditorRichTextEditorComponent + ], + imports: [ + CommonModule, + IonicModule, + TranslateModule.forChild(), + CoreComponentsModule, + ], + providers: [ + ], + exports: [ + CoreEditorRichTextEditorComponent + ], + entryComponents: [ + CoreEditorRichTextEditorComponent + ] +}) +export class CoreEditorComponentsModule {} diff --git a/src/components/rich-text-editor/core-rich-text-editor.html b/src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html similarity index 100% rename from src/components/rich-text-editor/core-rich-text-editor.html rename to src/core/editor/components/rich-text-editor/core-editor-rich-text-editor.html diff --git a/src/components/rich-text-editor/rich-text-editor.scss b/src/core/editor/components/rich-text-editor/rich-text-editor.scss similarity index 100% rename from src/components/rich-text-editor/rich-text-editor.scss rename to src/core/editor/components/rich-text-editor/rich-text-editor.scss diff --git a/src/components/rich-text-editor/rich-text-editor.ts b/src/core/editor/components/rich-text-editor/rich-text-editor.ts similarity index 97% rename from src/components/rich-text-editor/rich-text-editor.ts rename to src/core/editor/components/rich-text-editor/rich-text-editor.ts index d4367e509..8520959c5 100644 --- a/src/components/rich-text-editor/rich-text-editor.ts +++ b/src/core/editor/components/rich-text-editor/rich-text-editor.ts @@ -25,24 +25,18 @@ import { FormControl } from '@angular/forms'; import { Subscription } from 'rxjs'; /** - * Directive to display a rich text editor if enabled. + * Component to display a rich text editor if enabled. * - * If enabled, this directive will show a rich text editor. Otherwise it'll show a regular textarea. - * - * This directive requires an OBJECT model. The text written in the editor or textarea will be stored inside - * a "text" property in that object. This is to ensure 2-way data-binding, since using a string as a model - * could be easily broken. + * If enabled, this component will show a rich text editor. Otherwise it'll show a regular textarea. * * Example: * - * - * In the example above, the text written in the editor will be stored in newpost.text. */ @Component({ selector: 'core-rich-text-editor', - templateUrl: 'core-rich-text-editor.html' + templateUrl: 'core-editor-rich-text-editor.html' }) -export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy { +export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDestroy { // Based on: https://github.com/judgewest2000/Ionic3RichText/ // @todo: Anchor button, fullscreen... // @todo: Textarea height is not being updated when editor is resized. Height is calculated if any css is changed. diff --git a/src/core/editor/editor.module.ts b/src/core/editor/editor.module.ts new file mode 100644 index 000000000..1052cfb8b --- /dev/null +++ b/src/core/editor/editor.module.ts @@ -0,0 +1,27 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { NgModule } from '@angular/core'; +import { CoreEditorComponentsModule } from './components/components.module'; + +@NgModule({ + declarations: [ + ], + imports: [ + CoreEditorComponentsModule + ], + providers: [ + ] +}) +export class CoreEditorModule {}