@stratusjs/angular 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,8 +121,6 @@ import {
121
121
  } from 'ts-transformer-keys'
122
122
 
123
123
  // Froala External Requirements (Before Plugins are Loaded)
124
- import {EditorView, basicSetup, minimalSetup} from 'codemirror'
125
- import {html} from '@codemirror/lang-html'
126
124
  import 'html2pdf'
127
125
  import 'font-awesome'
128
126
 
@@ -176,9 +174,17 @@ import 'froala-image-tui'
176
174
  import '../froala/plugins/citationManager'
177
175
  import '../froala/plugins/linkManager'
178
176
  import '../froala/plugins/mediaManager'
179
- import {FroalaEditorDirective} from 'angular-froala-wysiwyg'
180
177
  // import '../froala/plugins/menuButton'
181
178
 
179
+ // Froala Directive
180
+ import {FroalaEditorDirective} from 'angular-froala-wysiwyg'
181
+
182
+ // CodeMirror Requirements
183
+ import {basicSetup} from 'codemirror'
184
+ import {Extension} from '@codemirror/state'
185
+ import {html} from '@codemirror/lang-html'
186
+ import {oneDarkTheme} from '@codemirror/theme-one-dark'
187
+
182
188
  // Local Setup
183
189
  const systemPackage = '@stratusjs/angular'
184
190
  const froalaPackage = 'froala-editor'
@@ -502,25 +508,24 @@ export class EditorComponent extends RootComponent implements OnInit, TriggerInt
502
508
  wrap_line_length: 0
503
509
  },
504
510
  // fromTextArea
505
- codeMirror: !cookie('codemirror') ? null : {
511
+ codeMirror: {
506
512
  fromTextArea: (el: HTMLTextAreaElement, opts: LooseObject) => {
513
+ const extensions: Array<Extension> = [
514
+ basicSetup,
515
+ html({
516
+ // extraTags: [
517
+ // 'sa-editor'
518
+ // ],
519
+ // extraGlobalAttributes: [
520
+ // 'stratus-src'
521
+ // ],
522
+ }),
523
+ ]
524
+ if (cookie('dark')) {
525
+ extensions.push(oneDarkTheme)
526
+ }
507
527
  // Note: We're instantiating a Bridge Class to act as an intermediate for Froala's legacy implementation.
508
- return new CodeMirrorBridge({
509
- extensions: [
510
- // basicSetup,
511
- minimalSetup,
512
- html({
513
- // extraTags: [
514
- // 'sa-editor'
515
- // ],
516
- // extraGlobalAttributes: [
517
- // 'stratus-src'
518
- // ],
519
- }),
520
- // TODO: Make this an optional extension, based on options
521
- // EditorView.lineWrapping
522
- ]
523
- }).fromTextArea(el, opts)
528
+ return new CodeMirrorBridge({extensions}).fromTextArea(el, opts)
524
529
  }
525
530
  },
526
531
  codeMirrorOptions: {
@@ -950,6 +955,7 @@ export class EditorComponent extends RootComponent implements OnInit, TriggerInt
950
955
  ],
951
956
  scrollableContainer: Stratus.Environment.get('viewPort') || 'body',
952
957
  spellcheck: true,
958
+ theme: cookie('dark') ? 'dark' : null,
953
959
  toolbarSticky: true,
954
960
  toolbarButtons: {
955
961
  moreText: {
@@ -1055,6 +1061,7 @@ export class EditorComponent extends RootComponent implements OnInit, TriggerInt
1055
1061
  // `${codeMirrorDir}lib/codemirror.css`,
1056
1062
  `${froalaDir}css/froala_editor.pkgd${min}.css`,
1057
1063
  // `${froalaDir}css/froala_style${min}.css`,
1064
+ `${froalaDir}css/themes/dark${min}.css`,
1058
1065
  `${froalaDir}css/third_party/embedly${min}.css`,
1059
1066
  `${froalaDir}css/third_party/font_awesome${min}.css`,
1060
1067
  `${froalaDir}css/third_party/image_tui${min}.css`,