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 { 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()
],

View File

@ -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;

View File

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

View File

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

View File

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

View File

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

View File

@ -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: [
],

View File

@ -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()
],

View File

@ -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()
],

View File

@ -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();

View File

@ -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()
],

View File

@ -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()
],

View File

@ -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()
],

View File

@ -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: [
],

View File

@ -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()
],

View File

@ -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()
],

View File

@ -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()
],

View File

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

View File

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

View File

@ -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,

View File

@ -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,

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';
/**
* 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:
* <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({
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.

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