diff --git a/.angular-cli.json b/.angular-cli.json
index c6bcd69..c2b6235 100644
--- a/.angular-cli.json
+++ b/.angular-cli.json
@@ -8,7 +8,6 @@
"root": "src",
"outDir": "dist-demo",
"assets": [
- "assets",
"favicon.ico"
],
"index": "index.html",
diff --git a/dist.tgz b/dist.tgz
index 6138d2d..9d36039 100644
Binary files a/dist.tgz and b/dist.tgz differ
diff --git a/dist/README.md b/dist/README.md
index 084d591..8ee98be 100644
--- a/dist/README.md
+++ b/dist/README.md
@@ -65,6 +65,19 @@ For example, below we are adding the highlight for `C#`, `JavaScript` and `TypeS
],
```
+### Import Module
+```typescript
+import { AngularMarkdownEditorModule } from 'angular-markdown-editor';
+
+@NgModule({
+ declarations: [],
+ imports: [AngularMarkdownEditorModule]
+
+ // or pre-define global configuration using the forRoot
+ // imports: [AngularMarkdownEditorModule.forRoot({ iconlibrary: 'fa' })]
+});
+```
+
### Input attributes
You can pass the following input attribute:
@@ -76,7 +89,7 @@ You can pass the following input attribute:
| **locale** | EditorLocale | no | locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries |
### Global Options
-The library comes with it's own Global Editor Options, these propertoes can be overriden at any by the `options` attribute. Click to see the [Global Options]() defined.
+The library comes with it's own Global Editor Options, these propertoes can be overriden at any by the `options` attribute. Click to see the [Global Options](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/global-editor-options.ts) defined.
### Event Hooks
You can hook to any of the [Bootstrap Markdown Editor Events](http://www.codingdrama.com/bootstrap-markdown/) through 2 ways, just choose the one you prefer:
@@ -148,7 +161,7 @@ export class MyComponent {
- onShow
### API - Editor Methods
-The editor API is quite dense and I will not list the entire set of methods, but you can see the entire list [here]().
+The editor API is quite dense and I will not list the entire set of methods, but you can see the entire list from the [Editor Method Interface](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/models/editorMethod.interface.ts).
To call any of the Editor Methods, you will have to first get a reference to the Editor's instance which you can get from the `onShow` callback.
Get the Editor's instance through the `onShow`, via the Custom Event (from the View) or Editor Option callback (just choose the one you prefer). Below shows how to get it through the latter option.
@@ -201,10 +214,10 @@ export class TestComponent implements OnInit {
```
### Additional Editor Buttons
-I really thought that some buttons were missing to go a great job (~~Strikethrough~~ & **Table**). So I added them directly in the [Global Options](). If you want to add your own, then just look at how it was done in the [Global Options]() and read the section `additionalButtons` of [Bootstrap Markdown](http://www.codingdrama.com/bootstrap-markdown/) website.
+I really thought that some buttons were missing to go a great job (~~Strikethrough~~ & **Table**). So I added them directly in the [Global Options](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/global-editor-options.ts). If you want to add your own, then just look at how it was done in the [Global Options](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/global-editor-options.ts) and read the section `additionalButtons` of [Bootstrap Markdown](http://www.codingdrama.com/bootstrap-markdown/) website.
### Adding Locale
-You can add a locale to the editor but passing a `locale` object (and bind it in the View) which contain a `language` and the dictionary of words used by the editor. The entire list of words can be seen in the example below. So for example, if we want to add French locale, we will do the following (you can see [demo code]()):
+You can add a locale to the editor but passing a `locale` object (and bind it in the View) which contain a `language` and the dictionary of words used by the editor. The entire list of words can be seen in the example below. So for example, if we want to add French locale, we will do the following (you can see [demo code](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/app/template/template.component.ts)):
###### View
```html
diff --git a/dist/angular-markdown-editor.d.ts b/dist/angular-markdown-editor.d.ts
index 7417cc8..a5c24e3 100644
--- a/dist/angular-markdown-editor.d.ts
+++ b/dist/angular-markdown-editor.d.ts
@@ -2,3 +2,5 @@
* Generated bundle index. Do not edit.
*/
export * from './public_api';
+export { MARKDOWN_EDITOR_VALUE_ACCESSOR as ɵa } from './lib/angular-markdown-editor/angular-markdown-editor.component';
+export { EditorOption as ɵb } from './lib/angular-markdown-editor/models';
diff --git a/dist/angular-markdown-editor.metadata.json b/dist/angular-markdown-editor.metadata.json
index a5dafba..1550273 100644
--- a/dist/angular-markdown-editor.metadata.json
+++ b/dist/angular-markdown-editor.metadata.json
@@ -1 +1 @@
-{"__symbolic":"module","version":4,"metadata":{"Dictionary":{"__symbolic":"interface"},"EditorInstance":{"__symbolic":"interface"},"EditorLocale":{"__symbolic":"interface"},"EditorMethod":{"__symbolic":"interface"},"EditorOption":{"__symbolic":"interface"},"Icon":{"__symbolic":"interface"},"IconSet":{"__symbolic":"interface"},"MarkdownEditorConfig":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor"}]}}},"origins":{"Dictionary":"./lib/angular-markdown-editor/models/dictionary.interface","EditorInstance":"./lib/angular-markdown-editor/models/editorInstance.interface","EditorLocale":"./lib/angular-markdown-editor/models/editorLocale.interface","EditorMethod":"./lib/angular-markdown-editor/models/editorMethod.interface","EditorOption":"./lib/angular-markdown-editor/models/editorOption.interface","Icon":"./lib/angular-markdown-editor/models/icon.interface","IconSet":"./lib/angular-markdown-editor/models/iconSet.interface","MarkdownEditorConfig":"./lib/angular-markdown-editor/markdown-editor-config"},"importAs":"angular-markdown-editor"}
\ No newline at end of file
+{"__symbolic":"module","version":4,"metadata":{"ɵa":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"AngularMarkdownEditorComponent"},"multi":true},"Dictionary":{"__symbolic":"interface"},"EditorInstance":{"__symbolic":"interface"},"EditorLocale":{"__symbolic":"interface"},"EditorMethod":{"__symbolic":"interface"},"EditorOption":{"__symbolic":"interface"},"Icon":{"__symbolic":"interface"},"IconSet":{"__symbolic":"interface"},"MarkdownEditorConfig":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor"}]}},"AngularMarkdownEditorComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"moduleId":"angulaMarkdownEditor","selector":"angular-markdown-editor","template":"","providers":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{"elm":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild"},"arguments":["markdownEditorElm"]}]}],"locale":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"textareaId":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"rows":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":["config"]}]],"parameters":[{"__symbolic":"reference","name":"ɵb"}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"addLocaleSet":[{"__symbolic":"method"}],"initialization":[{"__symbolic":"method"}],"hookToEditorEvents":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"dispatchCustomEvent":[{"__symbolic":"method"}]}},"AngularMarkdownEditorModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","name":"AngularMarkdownEditorComponent"}],"exports":[{"__symbolic":"reference","name":"AngularMarkdownEditorComponent"}],"entryComponents":[{"__symbolic":"reference","name":"AngularMarkdownEditorComponent"}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"defaults":[{}],"value":{"ngModule":{"__symbolic":"reference","name":"AngularMarkdownEditorModule"},"providers":[{"provide":"config","useValue":{"__symbolic":"reference","name":"config"}}]}}}}},"origins":{"ɵa":"./lib/angular-markdown-editor/angular-markdown-editor.component","Dictionary":"./lib/angular-markdown-editor/models/dictionary.interface","EditorInstance":"./lib/angular-markdown-editor/models/editorInstance.interface","EditorLocale":"./lib/angular-markdown-editor/models/editorLocale.interface","EditorMethod":"./lib/angular-markdown-editor/models/editorMethod.interface","EditorOption":"./lib/angular-markdown-editor/models/editorOption.interface","Icon":"./lib/angular-markdown-editor/models/icon.interface","IconSet":"./lib/angular-markdown-editor/models/iconSet.interface","MarkdownEditorConfig":"./lib/angular-markdown-editor/markdown-editor-config","AngularMarkdownEditorComponent":"./lib/angular-markdown-editor/angular-markdown-editor.component","AngularMarkdownEditorModule":"./lib/angular-markdown-editor/angular-markdown-editor.module","ɵb":"./lib/angular-markdown-editor/models"},"importAs":"angular-markdown-editor"}
\ No newline at end of file
diff --git a/dist/bundles/angular-markdown-editor.umd.js b/dist/bundles/angular-markdown-editor.umd.js
index f7ef6c5..f8534d9 100644
--- a/dist/bundles/angular-markdown-editor.umd.js
+++ b/dist/bundles/angular-markdown-editor.umd.js
@@ -1,8 +1,8 @@
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define('angular-markdown-editor', ['exports'], factory) :
- (factory((global['angular-markdown-editor'] = {})));
-}(this, (function (exports) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common')) :
+ typeof define === 'function' && define.amd ? define('angular-markdown-editor', ['exports', '@angular/core', '@angular/forms', '@angular/common'], factory) :
+ (factory((global['angular-markdown-editor'] = {}),global.ng.core,global.ng.forms,global.ng.common));
+}(this, (function (exports,core,forms,common) { 'use strict';
var GlobalEditorOptions = {
autofocus: false,
@@ -85,8 +85,140 @@ var MarkdownEditorConfig = /** @class */ (function () {
}
return MarkdownEditorConfig;
}());
+var MARKDOWN_EDITOR_VALUE_ACCESSOR = {
+ provide: forms.NG_VALUE_ACCESSOR,
+ useExisting: core.forwardRef(function () { return AngularMarkdownEditorComponent; }),
+ multi: true
+};
+var AngularMarkdownEditorComponent = /** @class */ (function () {
+ function AngularMarkdownEditorComponent(forRootConfig) {
+ this.forRootConfig = forRootConfig;
+ this.rows = 10;
+ this.onModelChange = function () { };
+ this.onModelTouched = function () { };
+ }
+ Object.defineProperty(AngularMarkdownEditorComponent.prototype, "locale", {
+ set: function (locale) {
+ this.addLocaleSet(locale);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ AngularMarkdownEditorComponent.prototype.ngAfterViewInit = function () {
+ this.initialization();
+ };
+ AngularMarkdownEditorComponent.prototype.addLocaleSet = function (editorLocale) {
+ if (!editorLocale) {
+ return;
+ }
+ if (Array.isArray(editorLocale)) {
+ editorLocale.forEach(function (locale) { return $.fn.markdown.messages[locale.language] = locale.dictionary; });
+ }
+ else {
+ $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;
+ }
+ };
+ AngularMarkdownEditorComponent.prototype.initialization = function () {
+ var _this = this;
+ var markdownDefaultOptions = $.fn.markdown.defaults;
+ var options = Object.assign({}, markdownDefaultOptions, GlobalEditorOptions, this.forRootConfig, this.options);
+ this.hookToEditorEvents(options);
+ var previousOnChange = options.onChange;
+ options.onChange = function (e) {
+ _this.onModelChange(e && e.getContent && e.getContent());
+ if (typeof previousOnChange === 'function') {
+ previousOnChange(e);
+ }
+ };
+ $("#" + this.textareaId).markdown(options);
+ };
+ AngularMarkdownEditorComponent.prototype.hookToEditorEvents = function (options) {
+ var _this = this;
+ var _loop_1 = function (prop) {
+ if (options.hasOwnProperty(prop) && prop.startsWith('on')) {
+ var previousEvent_1 = options[prop];
+ options[prop] = function (e) {
+ _this.dispatchCustomEvent(prop, { eventData: e });
+ if (typeof previousEvent_1 === 'function') {
+ previousEvent_1(e);
+ }
+ };
+ }
+ };
+ for (var prop in options) {
+ _loop_1(prop);
+ }
+ };
+ AngularMarkdownEditorComponent.prototype.writeValue = function (value) {
+ this.value = value;
+ if (this.value) {
+ this.elm.nativeElement.value = this.value;
+ }
+ };
+ AngularMarkdownEditorComponent.prototype.registerOnChange = function (fn) {
+ this.onModelChange = fn;
+ };
+ AngularMarkdownEditorComponent.prototype.registerOnTouched = function (fn) {
+ this.onModelTouched = fn;
+ };
+ AngularMarkdownEditorComponent.prototype.dispatchCustomEvent = function (eventName, data, isBubbling, isCancelable) {
+ if (isBubbling === void 0) { isBubbling = true; }
+ if (isCancelable === void 0) { isCancelable = true; }
+ var eventInit = { bubbles: isBubbling, cancelable: isCancelable };
+ if (data) {
+ eventInit.detail = data;
+ }
+ return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));
+ };
+ return AngularMarkdownEditorComponent;
+}());
+AngularMarkdownEditorComponent.decorators = [
+ { type: core.Injectable },
+ { type: core.Component, args: [{
+ moduleId: 'angulaMarkdownEditor',
+ selector: 'angular-markdown-editor',
+ template: '',
+ providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]
+ },] },
+];
+AngularMarkdownEditorComponent.ctorParameters = function () { return [
+ { type: undefined, decorators: [{ type: core.Inject, args: ['config',] },] },
+]; };
+AngularMarkdownEditorComponent.propDecorators = {
+ "elm": [{ type: core.ViewChild, args: ['markdownEditorElm',] },],
+ "locale": [{ type: core.Input },],
+ "textareaId": [{ type: core.Input },],
+ "options": [{ type: core.Input },],
+ "rows": [{ type: core.Input },],
+};
+var AngularMarkdownEditorModule = /** @class */ (function () {
+ function AngularMarkdownEditorModule() {
+ }
+ AngularMarkdownEditorModule.forRoot = function (config) {
+ if (config === void 0) { config = {}; }
+ return {
+ ngModule: AngularMarkdownEditorModule,
+ providers: [
+ { provide: 'config', useValue: config }
+ ]
+ };
+ };
+ return AngularMarkdownEditorModule;
+}());
+AngularMarkdownEditorModule.decorators = [
+ { type: core.NgModule, args: [{
+ imports: [common.CommonModule],
+ declarations: [AngularMarkdownEditorComponent],
+ exports: [AngularMarkdownEditorComponent],
+ entryComponents: [AngularMarkdownEditorComponent]
+ },] },
+];
+AngularMarkdownEditorModule.ctorParameters = function () { return []; };
exports.MarkdownEditorConfig = MarkdownEditorConfig;
+exports.AngularMarkdownEditorComponent = AngularMarkdownEditorComponent;
+exports.AngularMarkdownEditorModule = AngularMarkdownEditorModule;
+exports.ɵa = MARKDOWN_EDITOR_VALUE_ACCESSOR;
Object.defineProperty(exports, '__esModule', { value: true });
diff --git a/dist/bundles/angular-markdown-editor.umd.js.map b/dist/bundles/angular-markdown-editor.umd.js.map
index 7086a80..340bb13 100644
--- a/dist/bundles/angular-markdown-editor.umd.js.map
+++ b/dist/bundles/angular-markdown-editor.umd.js.map
@@ -2,13 +2,27 @@
"version": 3,
"file": "angular-markdown-editor.umd.js",
"sources": [
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.module.ts",
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.component.ts",
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/markdown-editor-config.ts",
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/global-editor-options.ts"
],
"sourcesContent": [
+ "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AngularMarkdownEditorComponent } from './angular-markdown-editor.component';\nimport { EditorOption } from './models';\n\n\n@NgModule({\n imports: [CommonModule],\n declarations: [AngularMarkdownEditorComponent],\n exports: [AngularMarkdownEditorComponent],\n entryComponents: [AngularMarkdownEditorComponent]\n})\nexport class AngularMarkdownEditorModule {\n static forRoot(config: EditorOption = {}) {\n return {\n ngModule: AngularMarkdownEditorModule,\n providers: [\n { provide: 'config', useValue: config }\n ]\n };\n }\n}\n",
+ "import { AfterViewInit, Component, ElementRef, forwardRef, Inject, Injectable, Input, ViewChild } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorLocale, EditorOption } from './models';\nimport { GlobalEditorOptions } from './global-editor-options';\n\ndeclare var $: any;\n\nexport const MARKDOWN_EDITOR_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AngularMarkdownEditorComponent),\n multi: true\n};\n\n@Injectable()\n@Component({\n moduleId: 'angulaMarkdownEditor',\n selector: 'angular-markdown-editor',\n template: '',\n providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]\n})\nexport class AngularMarkdownEditorComponent implements AfterViewInit {\n @ViewChild('markdownEditorElm') elm: ElementRef;\n\n /** Locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries */\n @Input()\n set locale(locale: EditorLocale | EditorLocale[]) {\n this.addLocaleSet(locale);\n }\n\n /** Id of the textarea DOM element used by the lib */\n @Input() textareaId: string;\n\n /** Markdown Editor Options to pass to the element */\n @Input() options?: EditorOption;\n\n /** Number of rows for the textarea */\n @Input() rows = 10;\n\n public value: any | any[];\n public onModelChange: Function = () => {};\n public onModelTouched: Function = () => {};\n\n constructor(@Inject('config') private forRootConfig: EditorOption) {}\n\n ngAfterViewInit() {\n this.initialization();\n }\n\n addLocaleSet(editorLocale: EditorLocale | EditorLocale[]) {\n if (!editorLocale) {\n return;\n }\n if (Array.isArray(editorLocale)) {\n editorLocale.forEach((locale: EditorLocale) => $.fn.markdown.messages[locale.language] = locale.dictionary);\n } else {\n $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;\n }\n }\n\n initialization() {\n // get all default options to get the entire list of onEvent so that we can attach Dispatch Custom Event to them\n // we also merge these with the options, and pass these merged options to the hookToEditorEvents() method to cover all onEvent callbacks\n const markdownDefaultOptions = $.fn.markdown.defaults;\n\n // re-hook new events that were optionally defined in the options\n // merge the options, the order matters (last options on the right have higher priorities)\n const options = { ...markdownDefaultOptions, ...GlobalEditorOptions, ...this.forRootConfig, ...this.options };\n\n // hook all events to respective callbacks\n // 1- could be coming from a Dispatched Event in the View:: (onX)=\"do()\"\n // 2- or from editor option callback in the Component:: const options = { onX: () => do() }\n this.hookToEditorEvents(options);\n\n // hook to the onChange event to update our model\n // however we don't want to override the previous callback, so we will run that one to if exists\n const previousOnChange = options.onChange;\n options.onChange = (e) => {\n this.onModelChange(e && e.getContent && e.getContent());\n if (typeof previousOnChange === 'function') {\n previousOnChange(e);\n }\n };\n\n // finally create the editor\n $(`#${this.textareaId}`).markdown(options);\n }\n\n /**\n * Hook any of the editor event(s) to Dispatch Custom Event so that we can use them in Angular with (onX)=\"doSomething($event.detail.eventData)\"\n * @param editor options\n */\n hookToEditorEvents(options) {\n for (const prop in options) {\n if (options.hasOwnProperty(prop) && prop.startsWith('on')) {\n const previousEvent = options[prop];\n\n // on Callback triggered\n options[prop] = (e) => {\n // Dispatch a Custom Event, so that the (onX)=\"do()\" from the View works\n this.dispatchCustomEvent(prop, { eventData: e });\n\n // if an event was passed through the options (instead of dispatch), and is not empty function, then we need to run it as well\n // basically we don't want the Dispatch Custom Event (onX)=\"do()\" to override the ones passed directly in the editor option callbacks\n if (typeof previousEvent === 'function') {\n previousEvent(e);\n }\n };\n }\n }\n }\n\n /**\n * Write value to the native element\n * @param value string\n */\n writeValue(value: string): void {\n this.value = value;\n\n // preset values in the DOM element\n if (this.value) {\n this.elm.nativeElement.value = this.value;\n }\n }\n\n registerOnChange(fn: Function): void {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: Function): void {\n this.onModelTouched = fn;\n }\n\n /** Dispatch of Custom Event, which by default will bubble & is cancelable */\n private dispatchCustomEvent(eventName: string, data?: any, isBubbling: boolean = true, isCancelable: boolean = true) {\n const eventInit: CustomEventInit = { bubbles: isBubbling, cancelable: isCancelable };\n if (data) {\n eventInit.detail = data;\n }\n return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));\n }\n}\n",
"import { GlobalEditorOptions } from './global-editor-options';\n\nexport class MarkdownEditorConfig {\n options: any;\n\n constructor() {\n this.options = GlobalEditorOptions;\n }\n}\n",
- "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n // additionalButtons: [],\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n"
+ "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n"
],
- "names": [],
- "mappings": ";;;;;;ACEA,IAAa,mBAAmB,GAAiB;IAE/C,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,EAAE;IACnB,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,KAAK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;;;;"
}
diff --git a/dist/bundles/angular-markdown-editor.umd.min.js b/dist/bundles/angular-markdown-editor.umd.min.js
index 6e83568..c3a981c 100644
--- a/dist/bundles/angular-markdown-editor.umd.min.js
+++ b/dist/bundles/angular-markdown-editor.umd.min.js
@@ -1,2 +1,2 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("angular-markdown-editor",["exports"],t):t(e["angular-markdown-editor"]={})}(this,function(e){"use strict";var t={autofocus:!1,disabledButtons:[],dropZoneOptions:null,enableDropDataUri:!1,footer:"",height:"inherit",hiddenButtons:[],hideable:!1,iconlibrary:"glyph",initialstate:"editor",language:"fr",additionalButtons:[[{name:"groupFont",data:[{name:"cmdStrikethrough",toggle:!1,title:"Strikethrough",icon:{fa:"fa fa-strikethrough",glyph:"glyphicon glyphicon-minus"},callback:function(e){var t,n,o=e.getSelection(),i=e.getContent();t=0===o.length?e.__localize("strikethrough"):o.text,"~~"===i.substr(o.start-2,2)&&"~~"===i.substr(o.end,2)?(e.setSelection(o.start-2,o.end+2),e.replaceSelection(t),n=o.start-2):(e.replaceSelection("~~"+t+"~~"),n=o.start+2),e.setSelection(n,n+t.length)}}]},{name:"groupMisc",data:[{name:"cmdTable",toggle:!1,title:"Table",icon:{fa:"fa fa-table",glyph:"glyphicon glyphicon-th"},callback:function(e){var t,n,o=e.getSelection();t="\n| Tables | Are | Cool | \n| ------------- |:-------------:| -----:| \n| col 3 is | right-aligned | $1600 | \n| col 2 is | centered | $12 | \n| zebra stripes | are neat | $1 |",e.replaceSelection(t),n=o.start,e.setSelection(n,n+t.length)}}]}]]},n=function(){this.options=t};e.MarkdownEditorConfig=n,Object.defineProperty(e,"__esModule",{value:!0})});
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common")):"function"==typeof define&&define.amd?define("angular-markdown-editor",["exports","@angular/core","@angular/forms","@angular/common"],e):e(t["angular-markdown-editor"]={},t.ng.core,t.ng.forms,t.ng.common)}(this,function(t,e,o,n){"use strict";var r={autofocus:!1,disabledButtons:[],dropZoneOptions:null,enableDropDataUri:!1,footer:"",height:"inherit",hiddenButtons:[],hideable:!1,iconlibrary:"glyph",initialstate:"editor",language:"fr",additionalButtons:[[{name:"groupFont",data:[{name:"cmdStrikethrough",toggle:!1,title:"Strikethrough",icon:{fa:"fa fa-strikethrough",glyph:"glyphicon glyphicon-minus"},callback:function(t){var e,o,n=t.getSelection(),r=t.getContent();e=0===n.length?t.__localize("strikethrough"):n.text,"~~"===r.substr(n.start-2,2)&&"~~"===r.substr(n.end,2)?(t.setSelection(n.start-2,n.end+2),t.replaceSelection(e),o=n.start-2):(t.replaceSelection("~~"+e+"~~"),o=n.start+2),t.setSelection(o,o+e.length)}}]},{name:"groupMisc",data:[{name:"cmdTable",toggle:!1,title:"Table",icon:{fa:"fa fa-table",glyph:"glyphicon glyphicon-th"},callback:function(t){var e,o,n=t.getSelection();e="\n| Tables | Are | Cool | \n| ------------- |:-------------:| -----:| \n| col 3 is | right-aligned | $1600 | \n| col 2 is | centered | $12 | \n| zebra stripes | are neat | $1 |",t.replaceSelection(e),o=n.start,t.setSelection(o,o+e.length)}}]}]]},a=function(){this.options=r},i={provide:o.NG_VALUE_ACCESSOR,useExisting:e.forwardRef(function(){return s}),multi:!0},s=function(){function t(t){this.forRootConfig=t,this.rows=10,this.onModelChange=function(){},this.onModelTouched=function(){}}return Object.defineProperty(t.prototype,"locale",{set:function(t){this.addLocaleSet(t)},enumerable:!0,configurable:!0}),t.prototype.ngAfterViewInit=function(){this.initialization()},t.prototype.addLocaleSet=function(t){t&&(Array.isArray(t)?t.forEach(function(t){return $.fn.markdown.messages[t.language]=t.dictionary}):$.fn.markdown.messages[t.language]=t.dictionary)},t.prototype.initialization=function(){var e=this,t=$.fn.markdown.defaults,o=Object.assign({},t,r,this.forRootConfig,this.options);this.hookToEditorEvents(o);var n=o.onChange;o.onChange=function(t){e.onModelChange(t&&t.getContent&&t.getContent()),"function"==typeof n&&n(t)},$("#"+this.textareaId).markdown(o)},t.prototype.hookToEditorEvents=function(t){var n=this,e=function(e){if(t.hasOwnProperty(e)&&e.startsWith("on")){var o=t[e];t[e]=function(t){n.dispatchCustomEvent(e,{eventData:t}),"function"==typeof o&&o(t)}}};for(var o in t)e(o)},t.prototype.writeValue=function(t){this.value=t,this.value&&(this.elm.nativeElement.value=this.value)},t.prototype.registerOnChange=function(t){this.onModelChange=t},t.prototype.registerOnTouched=function(t){this.onModelTouched=t},t.prototype.dispatchCustomEvent=function(t,e,o,n){void 0===o&&(o=!0),void 0===n&&(n=!0);var r={bubbles:o,cancelable:n};return e&&(r.detail=e),this.elm.nativeElement.dispatchEvent(new CustomEvent(t,r))},t}();s.decorators=[{type:e.Injectable},{type:e.Component,args:[{moduleId:"angulaMarkdownEditor",selector:"angular-markdown-editor",template:'',providers:[i]}]}],s.ctorParameters=function(){return[{type:undefined,decorators:[{type:e.Inject,args:["config"]}]}]},s.propDecorators={elm:[{type:e.ViewChild,args:["markdownEditorElm"]}],locale:[{type:e.Input}],textareaId:[{type:e.Input}],options:[{type:e.Input}],rows:[{type:e.Input}]};var l=function(){function e(){}return e.forRoot=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[{provide:"config",useValue:t}]}},e}();l.decorators=[{type:e.NgModule,args:[{imports:[n.CommonModule],declarations:[s],exports:[s],entryComponents:[s]}]}],l.ctorParameters=function(){return[]},t.MarkdownEditorConfig=a,t.AngularMarkdownEditorComponent=s,t.AngularMarkdownEditorModule=l,t.ɵa=i,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=angular-markdown-editor.umd.min.js.map
diff --git a/dist/bundles/angular-markdown-editor.umd.min.js.map b/dist/bundles/angular-markdown-editor.umd.min.js.map
index 69b11f0..5bbf7ba 100644
--- a/dist/bundles/angular-markdown-editor.umd.min.js.map
+++ b/dist/bundles/angular-markdown-editor.umd.min.js.map
@@ -3,11 +3,15 @@
"file": "angular-markdown-editor.umd.min.js",
"sources": [
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/global-editor-options.ts",
- "ng://angular-markdown-editor/out/lib/angular-markdown-editor/markdown-editor-config.ts"
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/markdown-editor-config.ts",
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.component.ts",
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.module.ts"
],
"sourcesContent": [
- "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n // additionalButtons: [],\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n",
- "import { GlobalEditorOptions } from './global-editor-options';\n\nexport class MarkdownEditorConfig {\n options: any;\n\n constructor() {\n this.options = GlobalEditorOptions;\n }\n}\n"
+ "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n",
+ "import { GlobalEditorOptions } from './global-editor-options';\n\nexport class MarkdownEditorConfig {\n options: any;\n\n constructor() {\n this.options = GlobalEditorOptions;\n }\n}\n",
+ "import { AfterViewInit, Component, ElementRef, forwardRef, Inject, Injectable, Input, ViewChild } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorLocale, EditorOption } from './models';\nimport { GlobalEditorOptions } from './global-editor-options';\n\ndeclare var $: any;\n\nexport const MARKDOWN_EDITOR_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AngularMarkdownEditorComponent),\n multi: true\n};\n\n@Injectable()\n@Component({\n moduleId: 'angulaMarkdownEditor',\n selector: 'angular-markdown-editor',\n template: '',\n providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]\n})\nexport class AngularMarkdownEditorComponent implements AfterViewInit {\n @ViewChild('markdownEditorElm') elm: ElementRef;\n\n /** Locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries */\n @Input()\n set locale(locale: EditorLocale | EditorLocale[]) {\n this.addLocaleSet(locale);\n }\n\n /** Id of the textarea DOM element used by the lib */\n @Input() textareaId: string;\n\n /** Markdown Editor Options to pass to the element */\n @Input() options?: EditorOption;\n\n /** Number of rows for the textarea */\n @Input() rows = 10;\n\n public value: any | any[];\n public onModelChange: Function = () => {};\n public onModelTouched: Function = () => {};\n\n constructor(@Inject('config') private forRootConfig: EditorOption) {}\n\n ngAfterViewInit() {\n this.initialization();\n }\n\n addLocaleSet(editorLocale: EditorLocale | EditorLocale[]) {\n if (!editorLocale) {\n return;\n }\n if (Array.isArray(editorLocale)) {\n editorLocale.forEach((locale: EditorLocale) => $.fn.markdown.messages[locale.language] = locale.dictionary);\n } else {\n $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;\n }\n }\n\n initialization() {\n // get all default options to get the entire list of onEvent so that we can attach Dispatch Custom Event to them\n // we also merge these with the options, and pass these merged options to the hookToEditorEvents() method to cover all onEvent callbacks\n const markdownDefaultOptions = $.fn.markdown.defaults;\n\n // re-hook new events that were optionally defined in the options\n // merge the options, the order matters (last options on the right have higher priorities)\n const options = { ...markdownDefaultOptions, ...GlobalEditorOptions, ...this.forRootConfig, ...this.options };\n\n // hook all events to respective callbacks\n // 1- could be coming from a Dispatched Event in the View:: (onX)=\"do()\"\n // 2- or from editor option callback in the Component:: const options = { onX: () => do() }\n this.hookToEditorEvents(options);\n\n // hook to the onChange event to update our model\n // however we don't want to override the previous callback, so we will run that one to if exists\n const previousOnChange = options.onChange;\n options.onChange = (e) => {\n this.onModelChange(e && e.getContent && e.getContent());\n if (typeof previousOnChange === 'function') {\n previousOnChange(e);\n }\n };\n\n // finally create the editor\n $(`#${this.textareaId}`).markdown(options);\n }\n\n /**\n * Hook any of the editor event(s) to Dispatch Custom Event so that we can use them in Angular with (onX)=\"doSomething($event.detail.eventData)\"\n * @param editor options\n */\n hookToEditorEvents(options) {\n for (const prop in options) {\n if (options.hasOwnProperty(prop) && prop.startsWith('on')) {\n const previousEvent = options[prop];\n\n // on Callback triggered\n options[prop] = (e) => {\n // Dispatch a Custom Event, so that the (onX)=\"do()\" from the View works\n this.dispatchCustomEvent(prop, { eventData: e });\n\n // if an event was passed through the options (instead of dispatch), and is not empty function, then we need to run it as well\n // basically we don't want the Dispatch Custom Event (onX)=\"do()\" to override the ones passed directly in the editor option callbacks\n if (typeof previousEvent === 'function') {\n previousEvent(e);\n }\n };\n }\n }\n }\n\n /**\n * Write value to the native element\n * @param value string\n */\n writeValue(value: string): void {\n this.value = value;\n\n // preset values in the DOM element\n if (this.value) {\n this.elm.nativeElement.value = this.value;\n }\n }\n\n registerOnChange(fn: Function): void {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: Function): void {\n this.onModelTouched = fn;\n }\n\n /** Dispatch of Custom Event, which by default will bubble & is cancelable */\n private dispatchCustomEvent(eventName: string, data?: any, isBubbling: boolean = true, isCancelable: boolean = true) {\n const eventInit: CustomEventInit = { bubbles: isBubbling, cancelable: isCancelable };\n if (data) {\n eventInit.detail = data;\n }\n return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));\n }\n}\n",
+ "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AngularMarkdownEditorComponent } from './angular-markdown-editor.component';\nimport { EditorOption } from './models';\n\n\n@NgModule({\n imports: [CommonModule],\n declarations: [AngularMarkdownEditorComponent],\n exports: [AngularMarkdownEditorComponent],\n entryComponents: [AngularMarkdownEditorComponent]\n})\nexport class AngularMarkdownEditorModule {\n static forRoot(config: EditorOption = {}) {\n return {\n ngModule: AngularMarkdownEditorModule,\n providers: [\n { provide: 'config', useValue: config }\n ]\n };\n }\n}\n"
],
"names": [
"GlobalEditorOptions",
@@ -48,7 +52,89 @@
"replaceSelection",
"MarkdownEditorConfig",
"this",
- "options"
+ "options",
+ "MARKDOWN_EDITOR_VALUE_ACCESSOR",
+ "provide",
+ "NG_VALUE_ACCESSOR",
+ "useExisting",
+ "forwardRef",
+ "AngularMarkdownEditorComponent",
+ "multi",
+ "forRootConfig",
+ "rows",
+ "onModelChange",
+ "onModelTouched",
+ "Object",
+ "defineProperty",
+ "prototype",
+ "set",
+ "locale",
+ "addLocaleSet",
+ "ngAfterViewInit",
+ "initialization",
+ "editorLocale",
+ "Array",
+ "isArray",
+ "forEach",
+ "$",
+ "fn",
+ "markdown",
+ "messages",
+ "dictionary",
+ "_this",
+ "markdownDefaultOptions",
+ "defaults",
+ "assign",
+ "hookToEditorEvents",
+ "previousOnChange",
+ "onChange",
+ "textareaId",
+ "_loop_1",
+ "prop",
+ "hasOwnProperty",
+ "startsWith",
+ "previousEvent_1",
+ "dispatchCustomEvent",
+ "eventData",
+ "writeValue",
+ "value",
+ "elm",
+ "nativeElement",
+ "registerOnChange",
+ "registerOnTouched",
+ "eventName",
+ "isBubbling",
+ "isCancelable",
+ "eventInit",
+ "bubbles",
+ "cancelable",
+ "detail",
+ "dispatchEvent",
+ "CustomEvent",
+ "type",
+ "Injectable",
+ "Component",
+ "args",
+ "moduleId",
+ "selector",
+ "template",
+ "providers",
+ "undefined",
+ "decorators",
+ "Inject",
+ "ViewChild",
+ "Input",
+ "AngularMarkdownEditorModule",
+ "forRoot",
+ "config",
+ "ngModule",
+ "useValue",
+ "NgModule",
+ "imports",
+ "CommonModule",
+ "declarations",
+ "exports",
+ "entryComponents"
],
- "mappings": "uOAEA,IAAaA,EAAoC,CAE/CC,WAAW,EACXC,gBAAiB,GACjBC,gBAAiB,KACjBC,mBAAmB,EACnBC,OAAQ,GACRC,OAAQ,UACRC,cAAe,GACfC,UAAU,EACVC,YAAa,QACbC,aAAc,SACdC,SAAU,KACVC,kBAAmB,CACjB,CAAC,CACDC,KAAM,YACNC,KAAM,CAAC,CACLD,KAAM,mBACNE,QAAQ,EACRC,MAAO,gBACPC,KAAM,CACJC,GAAI,sBACJC,MAAO,6BAETC,SAAU,SAACC,GAET,IAAIC,EACAC,EACEC,EAAWH,EAAEI,eACbC,EAAUL,EAAEM,aAIhBL,EAFsB,IAApBE,EAASI,OAEHP,EAAEQ,WAAW,iBAEbL,EAASM,KAI2B,OAA1CJ,EAAQK,OAAOP,EAASQ,MAAQ,EAAG,IACD,OAApCN,EAAQK,OAAOP,EAASS,IAAK,IAC7BZ,EAAEa,aAAaV,EAASQ,MAAQ,EAAGR,EAASS,IAAM,GAClDZ,EAAEc,iBAAiBb,GACnBC,EAASC,EAASQ,MAAQ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,EAAAA,QAGHvE,QAAA,CAAA,CAAA2D,KAAGY,EAAAA,QAGH9D,KAAA,CAAA,CAAAkD,KAAGY,EAAAA,SCpCH,IAAAC,EAAA,WAAA,SAAAA,YAaSA,EAATC,QAAE,SAAeC,GACb,YADJ,IAAAA,IAAiBA,EAAjB,IACW,CACLC,SAAUH,EACVN,UAAW,CACT,CAAEhE,QAAS,SAAU0E,SAAUF,QAjBvC,iBAMA,CAAAf,KAACkB,EAAAA,SAADf,KAAA,CAAU,CACRgB,QAAS,CAACC,EAAAA,cACVC,aAAc,CAAC1E,GACf2E,QAAS,CAAC3E,GACV4E,gBAAiB,CAAC5E"
}
diff --git a/dist/esm2015/angular-markdown-editor.js b/dist/esm2015/angular-markdown-editor.js
index db90c60..957fba7 100644
--- a/dist/esm2015/angular-markdown-editor.js
+++ b/dist/esm2015/angular-markdown-editor.js
@@ -1,9 +1,12 @@
+import { Component, forwardRef, Inject, Injectable, Input, ViewChild, NgModule } from '@angular/core';
+import { NG_VALUE_ACCESSOR } from '@angular/forms';
+import { CommonModule } from '@angular/common';
+
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
const GlobalEditorOptions = {
- // additionalButtons: [],
autofocus: false,
disabledButtons: [],
dropZoneOptions: null,
@@ -96,6 +99,197 @@ class MarkdownEditorConfig {
}
}
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+const MARKDOWN_EDITOR_VALUE_ACCESSOR = {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => AngularMarkdownEditorComponent),
+ multi: true
+};
+class AngularMarkdownEditorComponent {
+ /**
+ * @param {?} forRootConfig
+ */
+ constructor(forRootConfig) {
+ this.forRootConfig = forRootConfig;
+ /**
+ * Number of rows for the textarea
+ */
+ this.rows = 10;
+ this.onModelChange = () => { };
+ this.onModelTouched = () => { };
+ }
+ /**
+ * Locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries
+ * @param {?} locale
+ * @return {?}
+ */
+ set locale(locale) {
+ this.addLocaleSet(locale);
+ }
+ /**
+ * @return {?}
+ */
+ ngAfterViewInit() {
+ this.initialization();
+ }
+ /**
+ * @param {?} editorLocale
+ * @return {?}
+ */
+ addLocaleSet(editorLocale) {
+ if (!editorLocale) {
+ return;
+ }
+ if (Array.isArray(editorLocale)) {
+ editorLocale.forEach((locale) => $.fn.markdown.messages[locale.language] = locale.dictionary);
+ }
+ else {
+ $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;
+ }
+ }
+ /**
+ * @return {?}
+ */
+ initialization() {
+ // get all default options to get the entire list of onEvent so that we can attach Dispatch Custom Event to them
+ // we also merge these with the options, and pass these merged options to the hookToEditorEvents() method to cover all onEvent callbacks
+ const /** @type {?} */ markdownDefaultOptions = $.fn.markdown.defaults;
+ // re-hook new events that were optionally defined in the options
+ // merge the options, the order matters (last options on the right have higher priorities)
+ const /** @type {?} */ options = Object.assign({}, markdownDefaultOptions, GlobalEditorOptions, this.forRootConfig, this.options);
+ // hook all events to respective callbacks
+ // 1- could be coming from a Dispatched Event in the View:: (onX)="do()"
+ // 2- or from editor option callback in the Component:: const options = { onX: () => do() }
+ this.hookToEditorEvents(options);
+ // hook to the onChange event to update our model
+ // however we don't want to override the previous callback, so we will run that one to if exists
+ const /** @type {?} */ previousOnChange = options.onChange;
+ options.onChange = (e) => {
+ this.onModelChange(e && e.getContent && e.getContent());
+ if (typeof previousOnChange === 'function') {
+ previousOnChange(e);
+ }
+ };
+ // finally create the editor
+ $(`#${this.textareaId}`).markdown(options);
+ }
+ /**
+ * Hook any of the editor event(s) to Dispatch Custom Event so that we can use them in Angular with (onX)="doSomething($event.detail.eventData)"
+ * @param {?} options
+ * @return {?}
+ */
+ hookToEditorEvents(options) {
+ for (const /** @type {?} */ prop in options) {
+ if (options.hasOwnProperty(prop) && prop.startsWith('on')) {
+ const /** @type {?} */ previousEvent = options[prop];
+ // on Callback triggered
+ options[prop] = (e) => {
+ // Dispatch a Custom Event, so that the (onX)="do()" from the View works
+ this.dispatchCustomEvent(prop, { eventData: e });
+ // if an event was passed through the options (instead of dispatch), and is not empty function, then we need to run it as well
+ // basically we don't want the Dispatch Custom Event (onX)="do()" to override the ones passed directly in the editor option callbacks
+ if (typeof previousEvent === 'function') {
+ previousEvent(e);
+ }
+ };
+ }
+ }
+ }
+ /**
+ * Write value to the native element
+ * @param {?} value string
+ * @return {?}
+ */
+ writeValue(value) {
+ this.value = value;
+ // preset values in the DOM element
+ if (this.value) {
+ this.elm.nativeElement.value = this.value;
+ }
+ }
+ /**
+ * @param {?} fn
+ * @return {?}
+ */
+ registerOnChange(fn) {
+ this.onModelChange = fn;
+ }
+ /**
+ * @param {?} fn
+ * @return {?}
+ */
+ registerOnTouched(fn) {
+ this.onModelTouched = fn;
+ }
+ /**
+ * Dispatch of Custom Event, which by default will bubble & is cancelable
+ * @param {?} eventName
+ * @param {?=} data
+ * @param {?=} isBubbling
+ * @param {?=} isCancelable
+ * @return {?}
+ */
+ dispatchCustomEvent(eventName, data, isBubbling = true, isCancelable = true) {
+ const /** @type {?} */ eventInit = { bubbles: isBubbling, cancelable: isCancelable };
+ if (data) {
+ eventInit.detail = data;
+ }
+ return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));
+ }
+}
+AngularMarkdownEditorComponent.decorators = [
+ { type: Injectable },
+ { type: Component, args: [{
+ moduleId: 'angulaMarkdownEditor',
+ selector: 'angular-markdown-editor',
+ template: '',
+ providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]
+ },] },
+];
+/** @nocollapse */
+AngularMarkdownEditorComponent.ctorParameters = () => [
+ { type: undefined, decorators: [{ type: Inject, args: ['config',] },] },
+];
+AngularMarkdownEditorComponent.propDecorators = {
+ "elm": [{ type: ViewChild, args: ['markdownEditorElm',] },],
+ "locale": [{ type: Input },],
+ "textareaId": [{ type: Input },],
+ "options": [{ type: Input },],
+ "rows": [{ type: Input },],
+};
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+class AngularMarkdownEditorModule {
+ /**
+ * @param {?=} config
+ * @return {?}
+ */
+ static forRoot(config = {}) {
+ return {
+ ngModule: AngularMarkdownEditorModule,
+ providers: [
+ { provide: 'config', useValue: config }
+ ]
+ };
+ }
+}
+AngularMarkdownEditorModule.decorators = [
+ { type: NgModule, args: [{
+ imports: [CommonModule],
+ declarations: [AngularMarkdownEditorComponent],
+ exports: [AngularMarkdownEditorComponent],
+ entryComponents: [AngularMarkdownEditorComponent]
+ },] },
+];
+/** @nocollapse */
+AngularMarkdownEditorModule.ctorParameters = () => [];
+
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
@@ -115,5 +309,5 @@ class MarkdownEditorConfig {
* Generated bundle index. Do not edit.
*/
-export { MarkdownEditorConfig };
+export { MarkdownEditorConfig, AngularMarkdownEditorComponent, AngularMarkdownEditorModule, MARKDOWN_EDITOR_VALUE_ACCESSOR as ɵa };
//# sourceMappingURL=angular-markdown-editor.js.map
diff --git a/dist/esm2015/angular-markdown-editor.js.map b/dist/esm2015/angular-markdown-editor.js.map
index 7b73e3f..9eaf18e 100644
--- a/dist/esm2015/angular-markdown-editor.js.map
+++ b/dist/esm2015/angular-markdown-editor.js.map
@@ -2,13 +2,17 @@
"version": 3,
"file": "angular-markdown-editor.js",
"sources": [
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.module.ts",
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.component.ts",
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/markdown-editor-config.ts",
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/global-editor-options.ts"
],
"sourcesContent": [
+ "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AngularMarkdownEditorComponent } from './angular-markdown-editor.component';\nimport { EditorOption } from './models';\n\n\n@NgModule({\n imports: [CommonModule],\n declarations: [AngularMarkdownEditorComponent],\n exports: [AngularMarkdownEditorComponent],\n entryComponents: [AngularMarkdownEditorComponent]\n})\nexport class AngularMarkdownEditorModule {\n static forRoot(config: EditorOption = {}) {\n return {\n ngModule: AngularMarkdownEditorModule,\n providers: [\n { provide: 'config', useValue: config }\n ]\n };\n }\n}\n",
+ "import { AfterViewInit, Component, ElementRef, forwardRef, Inject, Injectable, Input, ViewChild } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorLocale, EditorOption } from './models';\nimport { GlobalEditorOptions } from './global-editor-options';\n\ndeclare var $: any;\n\nexport const MARKDOWN_EDITOR_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AngularMarkdownEditorComponent),\n multi: true\n};\n\n@Injectable()\n@Component({\n moduleId: 'angulaMarkdownEditor',\n selector: 'angular-markdown-editor',\n template: '',\n providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]\n})\nexport class AngularMarkdownEditorComponent implements AfterViewInit {\n @ViewChild('markdownEditorElm') elm: ElementRef;\n\n /** Locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries */\n @Input()\n set locale(locale: EditorLocale | EditorLocale[]) {\n this.addLocaleSet(locale);\n }\n\n /** Id of the textarea DOM element used by the lib */\n @Input() textareaId: string;\n\n /** Markdown Editor Options to pass to the element */\n @Input() options?: EditorOption;\n\n /** Number of rows for the textarea */\n @Input() rows = 10;\n\n public value: any | any[];\n public onModelChange: Function = () => {};\n public onModelTouched: Function = () => {};\n\n constructor(@Inject('config') private forRootConfig: EditorOption) {}\n\n ngAfterViewInit() {\n this.initialization();\n }\n\n addLocaleSet(editorLocale: EditorLocale | EditorLocale[]) {\n if (!editorLocale) {\n return;\n }\n if (Array.isArray(editorLocale)) {\n editorLocale.forEach((locale: EditorLocale) => $.fn.markdown.messages[locale.language] = locale.dictionary);\n } else {\n $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;\n }\n }\n\n initialization() {\n // get all default options to get the entire list of onEvent so that we can attach Dispatch Custom Event to them\n // we also merge these with the options, and pass these merged options to the hookToEditorEvents() method to cover all onEvent callbacks\n const markdownDefaultOptions = $.fn.markdown.defaults;\n\n // re-hook new events that were optionally defined in the options\n // merge the options, the order matters (last options on the right have higher priorities)\n const options = { ...markdownDefaultOptions, ...GlobalEditorOptions, ...this.forRootConfig, ...this.options };\n\n // hook all events to respective callbacks\n // 1- could be coming from a Dispatched Event in the View:: (onX)=\"do()\"\n // 2- or from editor option callback in the Component:: const options = { onX: () => do() }\n this.hookToEditorEvents(options);\n\n // hook to the onChange event to update our model\n // however we don't want to override the previous callback, so we will run that one to if exists\n const previousOnChange = options.onChange;\n options.onChange = (e) => {\n this.onModelChange(e && e.getContent && e.getContent());\n if (typeof previousOnChange === 'function') {\n previousOnChange(e);\n }\n };\n\n // finally create the editor\n $(`#${this.textareaId}`).markdown(options);\n }\n\n /**\n * Hook any of the editor event(s) to Dispatch Custom Event so that we can use them in Angular with (onX)=\"doSomething($event.detail.eventData)\"\n * @param editor options\n */\n hookToEditorEvents(options) {\n for (const prop in options) {\n if (options.hasOwnProperty(prop) && prop.startsWith('on')) {\n const previousEvent = options[prop];\n\n // on Callback triggered\n options[prop] = (e) => {\n // Dispatch a Custom Event, so that the (onX)=\"do()\" from the View works\n this.dispatchCustomEvent(prop, { eventData: e });\n\n // if an event was passed through the options (instead of dispatch), and is not empty function, then we need to run it as well\n // basically we don't want the Dispatch Custom Event (onX)=\"do()\" to override the ones passed directly in the editor option callbacks\n if (typeof previousEvent === 'function') {\n previousEvent(e);\n }\n };\n }\n }\n }\n\n /**\n * Write value to the native element\n * @param value string\n */\n writeValue(value: string): void {\n this.value = value;\n\n // preset values in the DOM element\n if (this.value) {\n this.elm.nativeElement.value = this.value;\n }\n }\n\n registerOnChange(fn: Function): void {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: Function): void {\n this.onModelTouched = fn;\n }\n\n /** Dispatch of Custom Event, which by default will bubble & is cancelable */\n private dispatchCustomEvent(eventName: string, data?: any, isBubbling: boolean = true, isCancelable: boolean = true) {\n const eventInit: CustomEventInit = { bubbles: isBubbling, cancelable: isCancelable };\n if (data) {\n eventInit.detail = data;\n }\n return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));\n }\n}\n",
"import { GlobalEditorOptions } from './global-editor-options';\n\nexport class MarkdownEditorConfig {\n options: any;\n\n constructor() {\n this.options = GlobalEditorOptions;\n }\n}\n",
- "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n // additionalButtons: [],\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n"
+ "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n"
],
"names": [],
- "mappings": ";;;;ACEA,AAAO,MAAM,mBAAmB,GAAiB;;IAE/C,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,EAAE;IACnB,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,EAAE;IACjB,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,OAAO;IACpB,YAAY,EAAE,QAAQ;IACtB,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE;QACjB,CAAC;gBACD,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,CAAC;wBACL,IAAI,EAAE,kBAAkB;wBACxB,MAAM,EAAE,KAAK;wBACb,KAAK,EAAE,eAAe;wBACtB,IAAI,EAAE;4BACJ,EAAE,EAAE,qBAAqB;4BACzB,KAAK,EAAE,2BAA2B;yBACnC;wBACD,QAAQ,EAAE,CAAC,CAAC,KAAlB;;4BAEQ,qBAAI,KAAK,CAAC;4BACV,qBAAI,MAAM,CAAC;4BACX,uBAAM,QAAQ,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC;4BAClC,uBAAM,OAAO,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;4BAE/B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;;gCAEzB,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;6BACvC;iCAAM;gCACL,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC;6BACvB;;4BAGD,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,CAA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,YAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;IAGA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;IAGA,MAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;;;;;;;ADpCA,AAYA,MAAA,2BAAA,CAAA;;;;;IACE,OAAO,OAAO,CAAC,MAAjB,GAAwC,EAAE,EAA1C;QACI,OAAO;YACL,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE;aACxC;SACF,CAAC;KACH;;;IAdH,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,YAAY,EAAE,CAAC,8BAA8B,CAAC;gBAC9C,OAAO,EAAE,CAAC,8BAA8B,CAAC;gBACzC,eAAe,EAAE,CAAC,8BAA8B,CAAC;aAClD,EAAD,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"
}
diff --git a/dist/esm5/angular-markdown-editor.js b/dist/esm5/angular-markdown-editor.js
index e99e92a..110d4a0 100644
--- a/dist/esm5/angular-markdown-editor.js
+++ b/dist/esm5/angular-markdown-editor.js
@@ -1,3 +1,7 @@
+import { Component, forwardRef, Inject, Injectable, Input, ViewChild, NgModule } from '@angular/core';
+import { NG_VALUE_ACCESSOR } from '@angular/forms';
+import { CommonModule } from '@angular/common';
+
var GlobalEditorOptions = {
autofocus: false,
disabledButtons: [],
@@ -79,6 +83,135 @@ var MarkdownEditorConfig = /** @class */ (function () {
}
return MarkdownEditorConfig;
}());
+var MARKDOWN_EDITOR_VALUE_ACCESSOR = {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(function () { return AngularMarkdownEditorComponent; }),
+ multi: true
+};
+var AngularMarkdownEditorComponent = /** @class */ (function () {
+ function AngularMarkdownEditorComponent(forRootConfig) {
+ this.forRootConfig = forRootConfig;
+ this.rows = 10;
+ this.onModelChange = function () { };
+ this.onModelTouched = function () { };
+ }
+ Object.defineProperty(AngularMarkdownEditorComponent.prototype, "locale", {
+ set: function (locale) {
+ this.addLocaleSet(locale);
+ },
+ enumerable: true,
+ configurable: true
+ });
+ AngularMarkdownEditorComponent.prototype.ngAfterViewInit = function () {
+ this.initialization();
+ };
+ AngularMarkdownEditorComponent.prototype.addLocaleSet = function (editorLocale) {
+ if (!editorLocale) {
+ return;
+ }
+ if (Array.isArray(editorLocale)) {
+ editorLocale.forEach(function (locale) { return $.fn.markdown.messages[locale.language] = locale.dictionary; });
+ }
+ else {
+ $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;
+ }
+ };
+ AngularMarkdownEditorComponent.prototype.initialization = function () {
+ var _this = this;
+ var markdownDefaultOptions = $.fn.markdown.defaults;
+ var options = Object.assign({}, markdownDefaultOptions, GlobalEditorOptions, this.forRootConfig, this.options);
+ this.hookToEditorEvents(options);
+ var previousOnChange = options.onChange;
+ options.onChange = function (e) {
+ _this.onModelChange(e && e.getContent && e.getContent());
+ if (typeof previousOnChange === 'function') {
+ previousOnChange(e);
+ }
+ };
+ $("#" + this.textareaId).markdown(options);
+ };
+ AngularMarkdownEditorComponent.prototype.hookToEditorEvents = function (options) {
+ var _this = this;
+ var _loop_1 = function (prop) {
+ if (options.hasOwnProperty(prop) && prop.startsWith('on')) {
+ var previousEvent_1 = options[prop];
+ options[prop] = function (e) {
+ _this.dispatchCustomEvent(prop, { eventData: e });
+ if (typeof previousEvent_1 === 'function') {
+ previousEvent_1(e);
+ }
+ };
+ }
+ };
+ for (var prop in options) {
+ _loop_1(prop);
+ }
+ };
+ AngularMarkdownEditorComponent.prototype.writeValue = function (value) {
+ this.value = value;
+ if (this.value) {
+ this.elm.nativeElement.value = this.value;
+ }
+ };
+ AngularMarkdownEditorComponent.prototype.registerOnChange = function (fn) {
+ this.onModelChange = fn;
+ };
+ AngularMarkdownEditorComponent.prototype.registerOnTouched = function (fn) {
+ this.onModelTouched = fn;
+ };
+ AngularMarkdownEditorComponent.prototype.dispatchCustomEvent = function (eventName, data, isBubbling, isCancelable) {
+ if (isBubbling === void 0) { isBubbling = true; }
+ if (isCancelable === void 0) { isCancelable = true; }
+ var eventInit = { bubbles: isBubbling, cancelable: isCancelable };
+ if (data) {
+ eventInit.detail = data;
+ }
+ return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));
+ };
+ return AngularMarkdownEditorComponent;
+}());
+AngularMarkdownEditorComponent.decorators = [
+ { type: Injectable },
+ { type: Component, args: [{
+ moduleId: 'angulaMarkdownEditor',
+ selector: 'angular-markdown-editor',
+ template: '',
+ providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]
+ },] },
+];
+AngularMarkdownEditorComponent.ctorParameters = function () { return [
+ { type: undefined, decorators: [{ type: Inject, args: ['config',] },] },
+]; };
+AngularMarkdownEditorComponent.propDecorators = {
+ "elm": [{ type: ViewChild, args: ['markdownEditorElm',] },],
+ "locale": [{ type: Input },],
+ "textareaId": [{ type: Input },],
+ "options": [{ type: Input },],
+ "rows": [{ type: Input },],
+};
+var AngularMarkdownEditorModule = /** @class */ (function () {
+ function AngularMarkdownEditorModule() {
+ }
+ AngularMarkdownEditorModule.forRoot = function (config) {
+ if (config === void 0) { config = {}; }
+ return {
+ ngModule: AngularMarkdownEditorModule,
+ providers: [
+ { provide: 'config', useValue: config }
+ ]
+ };
+ };
+ return AngularMarkdownEditorModule;
+}());
+AngularMarkdownEditorModule.decorators = [
+ { type: NgModule, args: [{
+ imports: [CommonModule],
+ declarations: [AngularMarkdownEditorComponent],
+ exports: [AngularMarkdownEditorComponent],
+ entryComponents: [AngularMarkdownEditorComponent]
+ },] },
+];
+AngularMarkdownEditorModule.ctorParameters = function () { return []; };
-export { MarkdownEditorConfig };
+export { MarkdownEditorConfig, AngularMarkdownEditorComponent, AngularMarkdownEditorModule, MARKDOWN_EDITOR_VALUE_ACCESSOR as ɵa };
//# sourceMappingURL=angular-markdown-editor.js.map
diff --git a/dist/esm5/angular-markdown-editor.js.map b/dist/esm5/angular-markdown-editor.js.map
index ed0c175..6358b92 100644
--- a/dist/esm5/angular-markdown-editor.js.map
+++ b/dist/esm5/angular-markdown-editor.js.map
@@ -2,13 +2,17 @@
"version": 3,
"file": "angular-markdown-editor.js",
"sources": [
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.module.ts",
+ "ng://angular-markdown-editor/out/lib/angular-markdown-editor/angular-markdown-editor.component.ts",
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/markdown-editor-config.ts",
"ng://angular-markdown-editor/out/lib/angular-markdown-editor/global-editor-options.ts"
],
"sourcesContent": [
+ "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { AngularMarkdownEditorComponent } from './angular-markdown-editor.component';\nimport { EditorOption } from './models';\n\n\n@NgModule({\n imports: [CommonModule],\n declarations: [AngularMarkdownEditorComponent],\n exports: [AngularMarkdownEditorComponent],\n entryComponents: [AngularMarkdownEditorComponent]\n})\nexport class AngularMarkdownEditorModule {\n static forRoot(config: EditorOption = {}) {\n return {\n ngModule: AngularMarkdownEditorModule,\n providers: [\n { provide: 'config', useValue: config }\n ]\n };\n }\n}\n",
+ "import { AfterViewInit, Component, ElementRef, forwardRef, Inject, Injectable, Input, ViewChild } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorLocale, EditorOption } from './models';\nimport { GlobalEditorOptions } from './global-editor-options';\n\ndeclare var $: any;\n\nexport const MARKDOWN_EDITOR_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AngularMarkdownEditorComponent),\n multi: true\n};\n\n@Injectable()\n@Component({\n moduleId: 'angulaMarkdownEditor',\n selector: 'angular-markdown-editor',\n template: '',\n providers: [MARKDOWN_EDITOR_VALUE_ACCESSOR]\n})\nexport class AngularMarkdownEditorComponent implements AfterViewInit {\n @ViewChild('markdownEditorElm') elm: ElementRef;\n\n /** Locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries */\n @Input()\n set locale(locale: EditorLocale | EditorLocale[]) {\n this.addLocaleSet(locale);\n }\n\n /** Id of the textarea DOM element used by the lib */\n @Input() textareaId: string;\n\n /** Markdown Editor Options to pass to the element */\n @Input() options?: EditorOption;\n\n /** Number of rows for the textarea */\n @Input() rows = 10;\n\n public value: any | any[];\n public onModelChange: Function = () => {};\n public onModelTouched: Function = () => {};\n\n constructor(@Inject('config') private forRootConfig: EditorOption) {}\n\n ngAfterViewInit() {\n this.initialization();\n }\n\n addLocaleSet(editorLocale: EditorLocale | EditorLocale[]) {\n if (!editorLocale) {\n return;\n }\n if (Array.isArray(editorLocale)) {\n editorLocale.forEach((locale: EditorLocale) => $.fn.markdown.messages[locale.language] = locale.dictionary);\n } else {\n $.fn.markdown.messages[editorLocale.language] = editorLocale.dictionary;\n }\n }\n\n initialization() {\n // get all default options to get the entire list of onEvent so that we can attach Dispatch Custom Event to them\n // we also merge these with the options, and pass these merged options to the hookToEditorEvents() method to cover all onEvent callbacks\n const markdownDefaultOptions = $.fn.markdown.defaults;\n\n // re-hook new events that were optionally defined in the options\n // merge the options, the order matters (last options on the right have higher priorities)\n const options = { ...markdownDefaultOptions, ...GlobalEditorOptions, ...this.forRootConfig, ...this.options };\n\n // hook all events to respective callbacks\n // 1- could be coming from a Dispatched Event in the View:: (onX)=\"do()\"\n // 2- or from editor option callback in the Component:: const options = { onX: () => do() }\n this.hookToEditorEvents(options);\n\n // hook to the onChange event to update our model\n // however we don't want to override the previous callback, so we will run that one to if exists\n const previousOnChange = options.onChange;\n options.onChange = (e) => {\n this.onModelChange(e && e.getContent && e.getContent());\n if (typeof previousOnChange === 'function') {\n previousOnChange(e);\n }\n };\n\n // finally create the editor\n $(`#${this.textareaId}`).markdown(options);\n }\n\n /**\n * Hook any of the editor event(s) to Dispatch Custom Event so that we can use them in Angular with (onX)=\"doSomething($event.detail.eventData)\"\n * @param editor options\n */\n hookToEditorEvents(options) {\n for (const prop in options) {\n if (options.hasOwnProperty(prop) && prop.startsWith('on')) {\n const previousEvent = options[prop];\n\n // on Callback triggered\n options[prop] = (e) => {\n // Dispatch a Custom Event, so that the (onX)=\"do()\" from the View works\n this.dispatchCustomEvent(prop, { eventData: e });\n\n // if an event was passed through the options (instead of dispatch), and is not empty function, then we need to run it as well\n // basically we don't want the Dispatch Custom Event (onX)=\"do()\" to override the ones passed directly in the editor option callbacks\n if (typeof previousEvent === 'function') {\n previousEvent(e);\n }\n };\n }\n }\n }\n\n /**\n * Write value to the native element\n * @param value string\n */\n writeValue(value: string): void {\n this.value = value;\n\n // preset values in the DOM element\n if (this.value) {\n this.elm.nativeElement.value = this.value;\n }\n }\n\n registerOnChange(fn: Function): void {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: Function): void {\n this.onModelTouched = fn;\n }\n\n /** Dispatch of Custom Event, which by default will bubble & is cancelable */\n private dispatchCustomEvent(eventName: string, data?: any, isBubbling: boolean = true, isCancelable: boolean = true) {\n const eventInit: CustomEventInit = { bubbles: isBubbling, cancelable: isCancelable };\n if (data) {\n eventInit.detail = data;\n }\n return this.elm.nativeElement.dispatchEvent(new CustomEvent(eventName, eventInit));\n }\n}\n",
"import { GlobalEditorOptions } from './global-editor-options';\n\nexport class MarkdownEditorConfig {\n options: any;\n\n constructor() {\n this.options = GlobalEditorOptions;\n }\n}\n",
- "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n // additionalButtons: [],\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n"
+ "import { EditorOption } from './models/editorOption.interface';\n\nexport const GlobalEditorOptions: EditorOption = {\n autofocus: false,\n disabledButtons: [],\n dropZoneOptions: null,\n enableDropDataUri: false,\n footer: '',\n height: 'inherit',\n hiddenButtons: [],\n hideable: false,\n iconlibrary: 'glyph',\n initialstate: 'editor',\n language: 'fr',\n additionalButtons: [\n [{\n name: 'groupFont',\n data: [{\n name: 'cmdStrikethrough',\n toggle: false,\n title: 'Strikethrough',\n icon: {\n fa: 'fa fa-strikethrough',\n glyph: 'glyphicon glyphicon-minus'\n },\n callback: (e) => {\n // Give/remove ~~ surround the selection\n let chunk;\n let cursor;\n const selected = e.getSelection();\n const content = e.getContent();\n\n if (selected.length === 0) {\n // Give extra word\n chunk = e.__localize('strikethrough');\n } else {\n chunk = selected.text;\n }\n\n // transform selection and set the cursor into chunked text\n if (content.substr(selected.start - 2, 2) === '~~' &&\n content.substr(selected.end, 2) === '~~') {\n e.setSelection(selected.start - 2, selected.end + 2);\n e.replaceSelection(chunk);\n cursor = selected.start - 2;\n } else {\n e.replaceSelection('~~' + chunk + '~~');\n cursor = selected.start + 2;\n }\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n },\n {\n name: 'groupMisc',\n data: [{\n name: 'cmdTable',\n toggle: false,\n title: 'Table',\n icon: {\n fa: 'fa fa-table',\n glyph: 'glyphicon glyphicon-th'\n },\n callback: (e) => {\n // Replace selection with some drinks\n let chunk;\n let cursor;\n const selected = e.getSelection();\n\n chunk = '\\n| Tables | Are | Cool | \\n'\n + '| ------------- |:-------------:| -----:| \\n'\n + '| col 3 is | right-aligned | $1600 | \\n'\n + '| col 2 is | centered | $12 | \\n'\n + '| zebra stripes | are neat | $1 |';\n\n // transform selection and set the cursor into chunked text\n e.replaceSelection(chunk);\n cursor = selected.start;\n\n // Set the cursor\n e.setSelection(cursor, cursor + chunk.length);\n }\n }]\n }]\n ]\n};\n"
],
"names": [],
- "mappings": "ACEA,IAAa,mBAAmB,GAAiB;IAE/C,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,EAAE;IACnB,eAAe,EAAE,IAAI;IACrB,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,EAAE;IACV,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,EAAE;IACjB,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,OAAO;IACpB,YAAY,EAAE,QAAQ;IACtB,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE;QACjB,CAAC;gBACD,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,CAAC;wBACL,IAAI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AAsB;gBAChC,QAAQ,EAAE,yBAAyB;gBACnC,QAAQ,EAAE,4HAA4H;gBACtI,SAAS,EAAE,CAAC,8BAA8B,CAAC;aAC5C,EAAD,EAAA;;;IAuBA,EAAA,IAAA,EAAA,SAAA,EAAA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAe,MAAM,EAArB,IAAA,EAAA,CAAsB,QAAQ,EAA9B,EAAA,EAAA,EAAA;;;IArBA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAG,SAAS,EAAZ,IAAA,EAAA,CAAa,mBAAmB,EAAhC,EAAA,EAAA;IAGA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;IAMA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;IAGA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;IAGA,MAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;;ADpCA;IAAA;;IAaS,mCAAO,GAAd,UAAe,MAAyB;QAAzB,uBAAA,EAAA,WAAyB;QACtC,OAAO;YACL,QAAQ,EAAE,2BAA2B;YACrC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE;aACxC;SACF,CAAC;KACH;;;;IAdH,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,YAAY,EAAE,CAAC,8BAA8B,CAAC;gBAC9C,OAAO,EAAE,CAAC,8BAA8B,CAAC;gBACzC,eAAe,EAAE,CAAC,8BAA8B,CAAC;aAClD,EAAD,EAAA;;;;;;"
}
diff --git a/dist/lib/angular-markdown-editor/angular-markdown-editor.component.d.ts b/dist/lib/angular-markdown-editor/angular-markdown-editor.component.d.ts
new file mode 100644
index 0000000..002c89c
--- /dev/null
+++ b/dist/lib/angular-markdown-editor/angular-markdown-editor.component.d.ts
@@ -0,0 +1,36 @@
+import { AfterViewInit, ElementRef } from '@angular/core';
+import { EditorLocale, EditorOption } from './models';
+export declare const MARKDOWN_EDITOR_VALUE_ACCESSOR: any;
+export declare class AngularMarkdownEditorComponent implements AfterViewInit {
+ private forRootConfig;
+ elm: ElementRef;
+ /** Locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries */
+ locale: EditorLocale | EditorLocale[];
+ /** Id of the textarea DOM element used by the lib */
+ textareaId: string;
+ /** Markdown Editor Options to pass to the element */
+ options?: EditorOption;
+ /** Number of rows for the textarea */
+ rows: number;
+ value: any | any[];
+ onModelChange: Function;
+ onModelTouched: Function;
+ constructor(forRootConfig: EditorOption);
+ ngAfterViewInit(): void;
+ addLocaleSet(editorLocale: EditorLocale | EditorLocale[]): void;
+ initialization(): void;
+ /**
+ * Hook any of the editor event(s) to Dispatch Custom Event so that we can use them in Angular with (onX)="doSomething($event.detail.eventData)"
+ * @param editor options
+ */
+ hookToEditorEvents(options: any): void;
+ /**
+ * Write value to the native element
+ * @param value string
+ */
+ writeValue(value: string): void;
+ registerOnChange(fn: Function): void;
+ registerOnTouched(fn: Function): void;
+ /** Dispatch of Custom Event, which by default will bubble & is cancelable */
+ private dispatchCustomEvent(eventName, data?, isBubbling?, isCancelable?);
+}
diff --git a/dist/lib/angular-markdown-editor/angular-markdown-editor.module.d.ts b/dist/lib/angular-markdown-editor/angular-markdown-editor.module.d.ts
new file mode 100644
index 0000000..4c0de84
--- /dev/null
+++ b/dist/lib/angular-markdown-editor/angular-markdown-editor.module.d.ts
@@ -0,0 +1,10 @@
+import { EditorOption } from './models';
+export declare class AngularMarkdownEditorModule {
+ static forRoot(config?: EditorOption): {
+ ngModule: typeof AngularMarkdownEditorModule;
+ providers: {
+ provide: string;
+ useValue: EditorOption;
+ }[];
+ };
+}
diff --git a/dist/lib/angular-markdown-editor/index.d.ts b/dist/lib/angular-markdown-editor/index.d.ts
index cd00c90..ea11a85 100644
--- a/dist/lib/angular-markdown-editor/index.d.ts
+++ b/dist/lib/angular-markdown-editor/index.d.ts
@@ -1,2 +1,4 @@
export * from './models/index';
export { MarkdownEditorConfig } from './markdown-editor-config';
+export { AngularMarkdownEditorComponent } from './angular-markdown-editor.component';
+export { AngularMarkdownEditorModule } from './angular-markdown-editor.module';
diff --git a/dist/package.json b/dist/package.json
index b5b83d7..cf354e2 100644
--- a/dist/package.json
+++ b/dist/package.json
@@ -1,6 +1,6 @@
{
"name": "angular-markdown-editor",
- "version": "2.0.0-beta",
+ "version": "2.0.1",
"description": "Bootstrap Markdown components made available in Angular",
"keywords": [
"angular",
@@ -19,7 +19,6 @@
"bootstrap": "^3.3.7",
"bootstrap-markdown": "toopay/bootstrap-markdown",
"core-js": "^2.5.1",
- "font-awesome": "^4.7.0",
"jquery": ">=3.2.1",
"vinyl-paths": "^2.1.0",
"tslib": "^1.7.1"
@@ -49,6 +48,7 @@
"custom-event-polyfill": "^0.3.0",
"del": "^3.0.0",
"del-cli": "^1.1.0",
+ "font-awesome": "^4.7.0",
"gulp": "^3.9.1",
"gulp-bump": "^2.7.0",
"gulp-sass": "^3.1.0",
diff --git a/package.json b/package.json
index 8f5c9ae..a98bed9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "angular-markdown-editor",
- "version": "2.0.0-beta",
+ "version": "2.0.1",
"description": "Bootstrap Markdown components made available in Angular",
"keywords": [
"angular",
@@ -15,9 +15,8 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
- "build-lib": "npm-run-all packagr copy:lib",
+ "build-lib": "npm-run-all packagr",
"build-lib-demo": "npm-run-all build-lib del-demo:dist copy-demo:dist",
- "copy:lib": "cross-env copyfiles --up 2 src/assets/lib/** dist",
"copy-demo:dist": "cross-env copyfiles --up 1 dist/**/*.* ../angular-markdown-editor-demo/node_lib/angular-markdown-editor",
"del-demo:dist": "cross-env rimraf ../angular-markdown-editor-demo/node_lib/angular-markdown-editor",
"pack-lib": "npm pack ./dist",
@@ -46,7 +45,6 @@
"bootstrap": "^3.3.7",
"bootstrap-markdown": "toopay/bootstrap-markdown",
"core-js": "^2.5.1",
- "font-awesome": "^4.7.0",
"jquery": ">=3.2.1",
"vinyl-paths": "^2.1.0"
},
@@ -75,6 +73,7 @@
"custom-event-polyfill": "^0.3.0",
"del": "^3.0.0",
"del-cli": "^1.1.0",
+ "font-awesome": "^4.7.0",
"gulp": "^3.9.1",
"gulp-bump": "^2.7.0",
"gulp-sass": "^3.1.0",
diff --git a/readme.md b/readme.md
index 084d591..8ee98be 100644
--- a/readme.md
+++ b/readme.md
@@ -65,6 +65,19 @@ For example, below we are adding the highlight for `C#`, `JavaScript` and `TypeS
],
```
+### Import Module
+```typescript
+import { AngularMarkdownEditorModule } from 'angular-markdown-editor';
+
+@NgModule({
+ declarations: [],
+ imports: [AngularMarkdownEditorModule]
+
+ // or pre-define global configuration using the forRoot
+ // imports: [AngularMarkdownEditorModule.forRoot({ iconlibrary: 'fa' })]
+});
+```
+
### Input attributes
You can pass the following input attribute:
@@ -76,7 +89,7 @@ You can pass the following input attribute:
| **locale** | EditorLocale | no | locale set that has a language and dictionary that can be added as an alternative language. Can be 1 or more dictionaries |
### Global Options
-The library comes with it's own Global Editor Options, these propertoes can be overriden at any by the `options` attribute. Click to see the [Global Options]() defined.
+The library comes with it's own Global Editor Options, these propertoes can be overriden at any by the `options` attribute. Click to see the [Global Options](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/global-editor-options.ts) defined.
### Event Hooks
You can hook to any of the [Bootstrap Markdown Editor Events](http://www.codingdrama.com/bootstrap-markdown/) through 2 ways, just choose the one you prefer:
@@ -148,7 +161,7 @@ export class MyComponent {
- onShow
### API - Editor Methods
-The editor API is quite dense and I will not list the entire set of methods, but you can see the entire list [here]().
+The editor API is quite dense and I will not list the entire set of methods, but you can see the entire list from the [Editor Method Interface](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/models/editorMethod.interface.ts).
To call any of the Editor Methods, you will have to first get a reference to the Editor's instance which you can get from the `onShow` callback.
Get the Editor's instance through the `onShow`, via the Custom Event (from the View) or Editor Option callback (just choose the one you prefer). Below shows how to get it through the latter option.
@@ -201,10 +214,10 @@ export class TestComponent implements OnInit {
```
### Additional Editor Buttons
-I really thought that some buttons were missing to go a great job (~~Strikethrough~~ & **Table**). So I added them directly in the [Global Options](). If you want to add your own, then just look at how it was done in the [Global Options]() and read the section `additionalButtons` of [Bootstrap Markdown](http://www.codingdrama.com/bootstrap-markdown/) website.
+I really thought that some buttons were missing to go a great job (~~Strikethrough~~ & **Table**). So I added them directly in the [Global Options](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/global-editor-options.ts). If you want to add your own, then just look at how it was done in the [Global Options](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/lib/angular-markdown-editor/global-editor-options.ts) and read the section `additionalButtons` of [Bootstrap Markdown](http://www.codingdrama.com/bootstrap-markdown/) website.
### Adding Locale
-You can add a locale to the editor but passing a `locale` object (and bind it in the View) which contain a `language` and the dictionary of words used by the editor. The entire list of words can be seen in the example below. So for example, if we want to add French locale, we will do the following (you can see [demo code]()):
+You can add a locale to the editor but passing a `locale` object (and bind it in the View) which contain a `language` and the dictionary of words used by the editor. The entire list of words can be seen in the example below. So for example, if we want to add French locale, we will do the following (you can see [demo code](https://github.com/ghiscoding/angular-markdown-editor/blob/master/src/app/template/template.component.ts)):
###### View
```html
diff --git a/src/app/reactive/reactive.component.ts b/src/app/reactive/reactive.component.ts
index 71c6fea..536e368 100644
--- a/src/app/reactive/reactive.component.ts
+++ b/src/app/reactive/reactive.component.ts
@@ -1,7 +1,7 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { MarkdownService } from 'ngx-markdown';
-import { EditorOption } from '../../lib/angular-markdown-editor';
+import { EditorInstance, EditorOption } from '../../lib/angular-markdown-editor';
@Component({
templateUrl: './reactive.component.html',
@@ -9,7 +9,7 @@ import { EditorOption } from '../../lib/angular-markdown-editor';
styleUrls: ['./reactive.component.scss']
})
export class ReactiveComponent implements OnInit {
- bsEditorInstance: any;
+ bsEditorInstance: EditorInstance;
markdownText: string;
showEditor = true;
templateForm: FormGroup;
diff --git a/src/assets/.gitkeep b/src/assets/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
deleted file mode 100644
index 6b77838..0000000
--- a/src/assets/i18n/en.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "ALL_SELECTED": "All Selected",
- "CANCEL": "Cancel",
- "CLEAR_ALL_FILTERS": "Clear All Filters",
- "CLEAR_ALL_SORTING": "Clear All Sorting",
- "COLUMNS": "Columns",
- "COMMANDS": "Commands",
- "CONTAINS": "Contains",
- "ENDS_WITH": "Ends With",
- "EQUALS": "Equals",
- "EXPORT_TO_CSV": "Export in CSV format",
- "EXPORT_TO_TAB_DELIMITED": "Export in Text format (Tab delimited)",
- "FROM_TO_OF_TOTAL_ITEMS": "{{from}}-{{to}} of {{totalItems}} items",
- "FORCE_FIT_COLUMNS": "Force fit columns",
- "INVALID_FLOAT": "The number must be valid and have a maximum of {{maxDecimal}} decimals.",
- "GROUP_BY": "Group by",
- "HIDE_COLUMN": "Hide Column",
- "IN_COLLECTION_SEPERATED_BY_COMMA": "Search items in a collection, must be separated by a comma (a,b)",
- "ITEMS": "Items",
- "ITEMS_PER_PAGE": "items per page",
- "NOT_IN_COLLECTION_SEPERATED_BY_COMMA": "Search items not in a collection, must be separated by a comma (a,b)",
- "OF": "of",
- "PAGE": "Page",
- "PAGE_X_OF_Y": "page {{x}} of {{y}}",
- "REFRESH_DATASET": "Refresh Dataset",
- "SAVE": "Save",
- "SELECT_ALL": "Select All",
- "SORT_ASCENDING": "Sort Ascending",
- "SORT_DESCENDING": "Sort Descending",
- "STARTS_WITH": "Starts With",
- "SYNCHRONOUS_RESIZE": "Synchronous resize",
- "TOGGLE_FILTER_ROW": "Toggle Filter Row",
- "X_OF_Y_SELECTED": "# of % selected",
-
- "BILLING": {
- "ADDRESS": {
- "STREET": "Billing Address Street",
- "ZIP": "Billing Address Zip"
- }
- },
- "CUSTOM_COMMANDS": "Custom Commands",
- "DURATION": "Duration",
- "COMPANY": "Company",
- "COMPLETED": "Completed",
- "FALSE": "False",
- "FEMALE": "Female",
- "FINISH": "Finish",
- "GENDER": "Gender",
- "HELP": "Help",
- "MALE": "Male",
- "NAME": "Name",
- "START": "Start",
- "TASK_X": "Task {{x}}",
- "TITLE": "Title",
- "TRUE": "True"
-}
diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json
deleted file mode 100644
index 0b9a2c6..0000000
--- a/src/assets/i18n/fr.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "ALL_SELECTED": "Tout sélectionnés",
- "CANCEL": "Annuler",
- "CLEAR_ALL_FILTERS": "Effacer tous les filtres",
- "CLEAR_ALL_SORTING": "Effacer tous les tris",
- "COLUMNS": "Colonnes",
- "COMMANDS": "Commandes",
- "CONTAINS": "Contient",
- "ENDS_WITH": "Se termine par",
- "EQUALS": "Égale",
- "EXPORT_TO_CSV": "Exporter en format CSV",
- "EXPORT_TO_TAB_DELIMITED": "Exporter en format texte (délimité par tabulation)",
- "FROM_TO_OF_TOTAL_ITEMS": "{{from}}-{{to}} de {{totalItems}} éléments",
- "FORCE_FIT_COLUMNS": "Ajustement forcé des colonnes",
- "GROUP_BY": "Grouper par",
- "HIDE_COLUMN": "Cacher la colonne",
- "IN_COLLECTION_SEPERATED_BY_COMMA": "Recherche incluant certain éléments d'une collection, doit être séparé par une virgule (a,b)",
- "INVALID_FLOAT": "Le nombre doit être valide et avoir un maximum de {{maxDecimal}} décimales.",
- "ITEMS": "Éléments",
- "ITEMS_PER_PAGE": "éléments par page",
- "NOT_IN_COLLECTION_SEPERATED_BY_COMMA": "Recherche excluant certain éléments d'une collection, doit être séparé par une virgule (a,b)",
- "OF": "de",
- "PAGE": "Page",
- "PAGE_X_OF_Y": "page {{x}} de {{y}}",
- "REFRESH_DATASET": "Rafraîchir les données",
- "SAVE": "Sauvegarder",
- "SELECT_ALL": "Sélectionner tout",
- "SORT_ASCENDING": "Trier par ordre croissant",
- "SORT_DESCENDING": "Trier par ordre décroissant",
- "STARTS_WITH": "Commence par",
- "SYNCHRONOUS_RESIZE": "Redimension synchrone",
- "TOGGLE_FILTER_ROW": "Basculer la ligne des filtres",
- "X_OF_Y_SELECTED": "# de % sélectionné",
-
- "BILLING": {
- "ADDRESS": {
- "STREET": "Adresse de facturation",
- "ZIP": "Code zip de facturation"
- }
- },
- "DURATION": "Durée",
- "COMPANY": "Compagnie",
- "COMPLETED": "Terminé",
- "CUSTOM_COMMANDS": "Commandes Personnalisées",
- "FALSE": "Faux",
- "FEMALE": "Féminin",
- "FINISH": "Fin",
- "GENDER": "Sexe",
- "HELP": "Aide",
- "MALE": "Masculin",
- "NAME": "Name",
- "START": "Début",
- "TASK_X": "Tâche {{x}}",
- "TITLE": "Titre",
- "TITLE.NAME": "Nom du Titre",
- "TRUE": "Vrai"
-}
diff --git a/src/lib/angular-markdown-editor/angular-markdown-editor.component.ts b/src/lib/angular-markdown-editor/angular-markdown-editor.component.ts
index 87d1582..e80327b 100644
--- a/src/lib/angular-markdown-editor/angular-markdown-editor.component.ts
+++ b/src/lib/angular-markdown-editor/angular-markdown-editor.component.ts
@@ -1,6 +1,6 @@
import { AfterViewInit, Component, ElementRef, forwardRef, Inject, Injectable, Input, ViewChild } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
-import { EditorLocale, EditorOption, Dictionary } from './models';
+import { EditorLocale, EditorOption } from './models';
import { GlobalEditorOptions } from './global-editor-options';
declare var $: any;
diff --git a/src/lib/angular-markdown-editor/angular-markdown-editor.module.ts b/src/lib/angular-markdown-editor/angular-markdown-editor.module.ts
index 9f90e36..c609f3a 100644
--- a/src/lib/angular-markdown-editor/angular-markdown-editor.module.ts
+++ b/src/lib/angular-markdown-editor/angular-markdown-editor.module.ts
@@ -5,15 +5,9 @@ import { EditorOption } from './models';
@NgModule({
- imports: [
- CommonModule
- ],
- declarations: [
- AngularMarkdownEditorComponent
- ],
- exports: [
- AngularMarkdownEditorComponent
- ],
+ imports: [CommonModule],
+ declarations: [AngularMarkdownEditorComponent],
+ exports: [AngularMarkdownEditorComponent],
entryComponents: [AngularMarkdownEditorComponent]
})
export class AngularMarkdownEditorModule {
diff --git a/src/lib/angular-markdown-editor/global-editor-options.ts b/src/lib/angular-markdown-editor/global-editor-options.ts
index 991dc32..c22d45f 100644
--- a/src/lib/angular-markdown-editor/global-editor-options.ts
+++ b/src/lib/angular-markdown-editor/global-editor-options.ts
@@ -1,7 +1,6 @@
import { EditorOption } from './models/editorOption.interface';
export const GlobalEditorOptions: EditorOption = {
- // additionalButtons: [],
autofocus: false,
disabledButtons: [],
dropZoneOptions: null,
diff --git a/src/lib/angular-markdown-editor/index.ts b/src/lib/angular-markdown-editor/index.ts
index a657595..47a0c27 100644
--- a/src/lib/angular-markdown-editor/index.ts
+++ b/src/lib/angular-markdown-editor/index.ts
@@ -3,3 +3,5 @@ export * from './models/index';
// components & module
export { MarkdownEditorConfig } from './markdown-editor-config';
+export { AngularMarkdownEditorComponent } from './angular-markdown-editor.component';
+export { AngularMarkdownEditorModule } from './angular-markdown-editor.module';
diff --git a/vscode.code-workspace b/vscode.code-workspace
deleted file mode 100644
index 60b24d8..0000000
--- a/vscode.code-workspace
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "folders": [
- {
- "path": "./"
- },
- {
- "path": "../Angular-Slickgrid-PackageTest"
- }
- ],
- "settings": {}
-}