MOBILE-3323 editor: Create new folder editor in src/core

main
Dani Palou 2020-01-28 12:52:56 +01:00
parent bc97553259
commit 96c8622608
26 changed files with 118 additions and 25 deletions

View File

@ -17,6 +17,7 @@ import { IonicPageModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
import { AddonCalendarEditEventPage } from './edit-event'; import { AddonCalendarEditEventPage } from './edit-event';
@NgModule({ @NgModule({
@ -26,6 +27,7 @@ import { AddonCalendarEditEventPage } from './edit-event';
imports: [ imports: [
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonCalendarEditEventPage), IonicPageModule.forChild(AddonCalendarEditEventPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -25,7 +25,7 @@ import { CoreTimeUtilsProvider } from '@providers/utils/time';
import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreCoursesProvider } from '@core/courses/providers/courses'; import { CoreCoursesProvider } from '@core/courses/providers/courses';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; 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 { AddonCalendarProvider, AddonCalendarGetAccessInfoResult, AddonCalendarEvent } from '../../providers/calendar';
import { AddonCalendarOfflineProvider } from '../../providers/calendar-offline'; import { AddonCalendarOfflineProvider } from '../../providers/calendar-offline';
import { AddonCalendarHelperProvider } from '../../providers/helper'; import { AddonCalendarHelperProvider } from '../../providers/helper';
@ -43,7 +43,7 @@ import { CoreFilterHelperProvider } from '@core/filter/providers/helper';
}) })
export class AddonCalendarEditEventPage implements OnInit, OnDestroy { export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
@ViewChild(CoreRichTextEditorComponent) descriptionEditor: CoreRichTextEditorComponent; @ViewChild(CoreEditorRichTextEditorComponent) descriptionEditor: CoreEditorRichTextEditorComponent;
title: string; title: string;
dateFormat: string; dateFormat: string;

View File

@ -21,6 +21,7 @@ import { AddonModAssignFeedbackCommentsComponent } from './component/comments';
import { AddonModAssignFeedbackDelegate } from '../../providers/feedback-delegate'; import { AddonModAssignFeedbackDelegate } from '../../providers/feedback-delegate';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -31,7 +32,8 @@ import { CoreDirectivesModule } from '@directives/directives.module';
IonicModule, IonicModule,
TranslateModule.forChild(), TranslateModule.forChild(),
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule CoreDirectivesModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
AddonModAssignFeedbackCommentsHandler AddonModAssignFeedbackCommentsHandler

View File

@ -21,6 +21,7 @@ import { AddonModAssignSubmissionOnlineTextComponent } from './component/onlinet
import { AddonModAssignSubmissionDelegate } from '../../providers/submission-delegate'; import { AddonModAssignSubmissionDelegate } from '../../providers/submission-delegate';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -31,7 +32,8 @@ import { CoreDirectivesModule } from '@directives/directives.module';
IonicModule, IonicModule,
TranslateModule.forChild(), TranslateModule.forChild(),
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule CoreDirectivesModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
AddonModAssignSubmissionOnlineTextHandler AddonModAssignSubmissionOnlineTextHandler

View File

@ -40,7 +40,7 @@ import { AddonModDataFieldUrlModule } from './url/url.module';
AddonModDataFieldRadiobuttonModule, AddonModDataFieldRadiobuttonModule,
AddonModDataFieldTextModule, AddonModDataFieldTextModule,
AddonModDataFieldTextareaModule, AddonModDataFieldTextareaModule,
AddonModDataFieldUrlModule AddonModDataFieldUrlModule,
], ],
providers: [ providers: [
], ],

View File

@ -20,6 +20,7 @@ import { AddonModDataFieldsDelegate } from '../../providers/fields-delegate';
import { AddonModDataFieldTextareaComponent } from './component/textarea'; import { AddonModDataFieldTextareaComponent } from './component/textarea';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -30,7 +31,8 @@ import { CoreDirectivesModule } from '@directives/directives.module';
IonicModule, IonicModule,
TranslateModule.forChild(), TranslateModule.forChild(),
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule CoreDirectivesModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
AddonModDataFieldTextareaHandler AddonModDataFieldTextareaHandler

View File

@ -26,6 +26,7 @@ import { AddonModForumIndexComponent } from './index/index';
import { AddonModForumPostComponent } from './post/post'; import { AddonModForumPostComponent } from './post/post';
import { AddonForumDiscussionOptionsMenuComponent } from './discussion-options-menu/discussion-options-menu'; import { AddonForumDiscussionOptionsMenuComponent } from './discussion-options-menu/discussion-options-menu';
import { AddonForumPostOptionsMenuComponent } from './post-options-menu/post-options-menu'; import { AddonForumPostOptionsMenuComponent } from './post-options-menu/post-options-menu';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -43,7 +44,8 @@ import { AddonForumPostOptionsMenuComponent } from './post-options-menu/post-opt
CorePipesModule, CorePipesModule,
CoreCourseComponentsModule, CoreCourseComponentsModule,
CoreRatingComponentsModule, CoreRatingComponentsModule,
CoreTagComponentsModule CoreTagComponentsModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
], ],

View File

@ -19,6 +19,7 @@ import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModForumComponentsModule } from '../../components/components.module'; import { AddonModForumComponentsModule } from '../../components/components.module';
import { AddonModForumEditPostPage } from './edit-post'; import { AddonModForumEditPostPage } from './edit-post';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -28,6 +29,7 @@ import { AddonModForumEditPostPage } from './edit-post';
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
AddonModForumComponentsModule, AddonModForumComponentsModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModForumEditPostPage), IonicPageModule.forChild(AddonModForumEditPostPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModForumNewDiscussionPage } from './new-discussion'; import { AddonModForumNewDiscussionPage } from './new-discussion';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -26,6 +27,7 @@ import { AddonModForumNewDiscussionPage } from './new-discussion';
imports: [ imports: [
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModForumNewDiscussionPage), IonicPageModule.forChild(AddonModForumNewDiscussionPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -25,7 +25,7 @@ import { CoreTextUtilsProvider } from '@providers/utils/text';
import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreFileUploaderProvider } from '@core/fileuploader/providers/fileuploader'; import { CoreFileUploaderProvider } from '@core/fileuploader/providers/fileuploader';
import { CoreSplitViewComponent } from '@components/split-view/split-view'; 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 { AddonModForumProvider } from '../../providers/forum';
import { AddonModForumOfflineProvider } from '../../providers/offline'; import { AddonModForumOfflineProvider } from '../../providers/offline';
import { AddonModForumHelperProvider } from '../../providers/helper'; import { AddonModForumHelperProvider } from '../../providers/helper';
@ -41,7 +41,7 @@ import { AddonModForumSyncProvider } from '../../providers/sync';
}) })
export class AddonModForumNewDiscussionPage implements OnDestroy { export class AddonModForumNewDiscussionPage implements OnDestroy {
@ViewChild(CoreRichTextEditorComponent) messageEditor: CoreRichTextEditorComponent; @ViewChild(CoreEditorRichTextEditorComponent) messageEditor: CoreEditorRichTextEditorComponent;
component = AddonModForumProvider.COMPONENT; component = AddonModForumProvider.COMPONENT;
messageControl = new FormControl(); messageControl = new FormControl();

View File

@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModGlossaryEditPage } from './edit'; import { AddonModGlossaryEditPage } from './edit';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -26,6 +27,7 @@ import { AddonModGlossaryEditPage } from './edit';
imports: [ imports: [
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModGlossaryEditPage), IonicPageModule.forChild(AddonModGlossaryEditPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModLessonPlayerPage } from './player'; import { AddonModLessonPlayerPage } from './player';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -26,6 +27,7 @@ import { AddonModLessonPlayerPage } from './player';
imports: [ imports: [
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModLessonPlayerPage), IonicPageModule.forChild(AddonModLessonPlayerPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModWikiEditPage } from './edit'; import { AddonModWikiEditPage } from './edit';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -26,6 +27,7 @@ import { AddonModWikiEditPage } from './edit';
imports: [ imports: [
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModWikiEditPage), IonicPageModule.forChild(AddonModWikiEditPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -24,6 +24,7 @@ import { AddonModWorkshopIndexComponent } from './index/index';
import { AddonModWorkshopSubmissionComponent } from './submission/submission'; import { AddonModWorkshopSubmissionComponent } from './submission/submission';
import { AddonModWorkshopAssessmentComponent } from './assessment/assessment'; import { AddonModWorkshopAssessmentComponent } from './assessment/assessment';
import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strategy/assessment-strategy'; import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strategy/assessment-strategy';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -39,7 +40,8 @@ import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strate
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule, CoreDirectivesModule,
CorePipesModule, CorePipesModule,
CoreCourseComponentsModule CoreCourseComponentsModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
], ],

View File

@ -19,6 +19,7 @@ import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModWorkshopComponentsModule } from '../../components/components.module'; import { AddonModWorkshopComponentsModule } from '../../components/components.module';
import { AddonModWorkshopAssessmentPage } from './assessment'; import { AddonModWorkshopAssessmentPage } from './assessment';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -28,6 +29,7 @@ import { AddonModWorkshopAssessmentPage } from './assessment';
CoreDirectivesModule, CoreDirectivesModule,
CoreComponentsModule, CoreComponentsModule,
AddonModWorkshopComponentsModule, AddonModWorkshopComponentsModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModWorkshopAssessmentPage), IonicPageModule.forChild(AddonModWorkshopAssessmentPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -18,6 +18,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModWorkshopEditSubmissionPage } from './edit-submission'; import { AddonModWorkshopEditSubmissionPage } from './edit-submission';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -26,6 +27,7 @@ import { AddonModWorkshopEditSubmissionPage } from './edit-submission';
imports: [ imports: [
CoreDirectivesModule, CoreDirectivesModule,
CoreComponentsModule, CoreComponentsModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModWorkshopEditSubmissionPage), IonicPageModule.forChild(AddonModWorkshopEditSubmissionPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -19,6 +19,7 @@ import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonModWorkshopComponentsModule } from '../../components/components.module'; import { AddonModWorkshopComponentsModule } from '../../components/components.module';
import { AddonModWorkshopSubmissionPage } from './submission'; import { AddonModWorkshopSubmissionPage } from './submission';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -28,6 +29,7 @@ import { AddonModWorkshopSubmissionPage } from './submission';
CoreDirectivesModule, CoreDirectivesModule,
CoreComponentsModule, CoreComponentsModule,
AddonModWorkshopComponentsModule, AddonModWorkshopComponentsModule,
CoreEditorComponentsModule,
IonicPageModule.forChild(AddonModWorkshopSubmissionPage), IonicPageModule.forChild(AddonModWorkshopSubmissionPage),
TranslateModule.forChild() TranslateModule.forChild()
], ],

View File

@ -20,6 +20,7 @@ import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { AddonQtypeEssayHandler } from './providers/handler'; import { AddonQtypeEssayHandler } from './providers/handler';
import { AddonQtypeEssayComponent } from './component/essay'; import { AddonQtypeEssayComponent } from './component/essay';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -29,7 +30,8 @@ import { AddonQtypeEssayComponent } from './component/essay';
IonicModule, IonicModule,
TranslateModule.forChild(), TranslateModule.forChild(),
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule CoreDirectivesModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
AddonQtypeEssayHandler AddonQtypeEssayHandler

View File

@ -20,6 +20,7 @@ import { CoreUserProfileFieldDelegate } from '@core/user/providers/user-profile-
import { AddonUserProfileFieldTextareaComponent } from './component/textarea'; import { AddonUserProfileFieldTextareaComponent } from './component/textarea';
import { CoreComponentsModule } from '@components/components.module'; import { CoreComponentsModule } from '@components/components.module';
import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -29,7 +30,8 @@ import { CoreDirectivesModule } from '@directives/directives.module';
IonicModule, IonicModule,
TranslateModule.forChild(), TranslateModule.forChild(),
CoreComponentsModule, CoreComponentsModule,
CoreDirectivesModule CoreDirectivesModule,
CoreEditorComponentsModule,
], ],
providers: [ providers: [
AddonUserProfileFieldTextareaHandler AddonUserProfileFieldTextareaHandler

View File

@ -87,6 +87,7 @@ import { CoreTagModule } from '@core/tag/tag.module';
import { CoreFilterModule } from '@core/filter/filter.module'; import { CoreFilterModule } from '@core/filter/filter.module';
import { CoreH5PModule } from '@core/h5p/h5p.module'; import { CoreH5PModule } from '@core/h5p/h5p.module';
import { CoreSearchModule } from '@core/search/search.module'; import { CoreSearchModule } from '@core/search/search.module';
import { CoreEditorModule } from '@core/editor/editor.module';
// Addon modules. // Addon modules.
import { AddonBadgesModule } from '@addon/badges/badges.module'; import { AddonBadgesModule } from '@addon/badges/badges.module';
@ -235,6 +236,7 @@ export const WP_PROVIDER: any = null;
CoreFilterModule, CoreFilterModule,
CoreH5PModule, CoreH5PModule,
CoreSearchModule, CoreSearchModule,
CoreEditorModule,
AddonBadgesModule, AddonBadgesModule,
AddonBlogModule, AddonBlogModule,
AddonCalendarModule, AddonCalendarModule,

View File

@ -39,7 +39,6 @@ import { CoreLocalFileComponent } from './local-file/local-file';
import { CoreSitePickerComponent } from './site-picker/site-picker'; import { CoreSitePickerComponent } from './site-picker/site-picker';
import { CoreTabsComponent } from './tabs/tabs'; import { CoreTabsComponent } from './tabs/tabs';
import { CoreTabComponent } from './tabs/tab'; import { CoreTabComponent } from './tabs/tab';
import { CoreRichTextEditorComponent } from './rich-text-editor/rich-text-editor';
import { CoreNavBarButtonsComponent } from './navbar-buttons/navbar-buttons'; import { CoreNavBarButtonsComponent } from './navbar-buttons/navbar-buttons';
import { CoreDynamicComponent } from './dynamic-component/dynamic-component'; import { CoreDynamicComponent } from './dynamic-component/dynamic-component';
import { CoreSendMessageFormComponent } from './send-message-form/send-message-form'; import { CoreSendMessageFormComponent } from './send-message-form/send-message-form';
@ -79,7 +78,6 @@ import { CoreBSTooltipComponent } from './bs-tooltip/bs-tooltip';
CoreSitePickerComponent, CoreSitePickerComponent,
CoreTabsComponent, CoreTabsComponent,
CoreTabComponent, CoreTabComponent,
CoreRichTextEditorComponent,
CoreNavBarButtonsComponent, CoreNavBarButtonsComponent,
CoreDynamicComponent, CoreDynamicComponent,
CoreSendMessageFormComponent, CoreSendMessageFormComponent,
@ -128,7 +126,6 @@ import { CoreBSTooltipComponent } from './bs-tooltip/bs-tooltip';
CoreSitePickerComponent, CoreSitePickerComponent,
CoreTabsComponent, CoreTabsComponent,
CoreTabComponent, CoreTabComponent,
CoreRichTextEditorComponent,
CoreNavBarButtonsComponent, CoreNavBarButtonsComponent,
CoreDynamicComponent, CoreDynamicComponent,
CoreSendMessageFormComponent, CoreSendMessageFormComponent,

View File

@ -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 {}

View File

@ -25,24 +25,18 @@ import { FormControl } from '@angular/forms';
import { Subscription } from 'rxjs'; 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. * If enabled, this component 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.
* *
* Example: * Example:
* <core-rich-text-editor item-content [control]="control" [placeholder]="field.name"></core-rich-text-editor> * <core-rich-text-editor item-content [control]="control" [placeholder]="field.name"></core-rich-text-editor>
*
* In the example above, the text written in the editor will be stored in newpost.text.
*/ */
@Component({ @Component({
selector: 'core-rich-text-editor', 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/ // Based on: https://github.com/judgewest2000/Ionic3RichText/
// @todo: Anchor button, fullscreen... // @todo: Anchor button, fullscreen...
// @todo: Textarea height is not being updated when editor is resized. Height is calculated if any css is changed. // @todo: Textarea height is not being updated when editor is resized. Height is calculated if any css is changed.

View File

@ -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 {}