Skip to content

Commit

Permalink
Fixed #5695 - More options for Editor
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Jan 3, 2019
1 parent aeee9cb commit c63270a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
21 changes: 16 additions & 5 deletions src/app/components/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export class Editor implements AfterViewInit,ControlValueAccessor {
@Input() placeholder: string;

@Input() formats: string[];

@Input() modules: any;

@Input() bounds: Element;

@Input() scrollingContainer: Element;

@Input() debug: string;

@Output() onInit: EventEmitter<any> = new EventEmitter();

Expand All @@ -98,15 +106,18 @@ export class Editor implements AfterViewInit,ControlValueAccessor {
ngAfterViewInit() {
let editorElement = this.domHandler.findSingle(this.el.nativeElement ,'div.ui-editor-content');
let toolbarElement = this.domHandler.findSingle(this.el.nativeElement ,'div.ui-editor-toolbar');

let defaultModule = {toolbar: toolbarElement};
let modules = this.modules ? {...defaultModule, ...this.modules} : defaultModule;

this.quill = new Quill(editorElement, {
modules: {
toolbar: toolbarElement
},
modules: modules,
placeholder: this.placeholder,
readOnly: this.readonly,
theme: 'snow',
formats: this.formats
formats: this.formats,
bounds: this.bounds,
debug: this.debug,
scrollingContainer: this.scrollingContainer
});

if(this.value) {
Expand Down
27 changes: 26 additions & 1 deletion src/app/showcase/components/editor/editordemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,32 @@ <h3>Properties</h3>
<td>null</td>
<td>Whitelist of formats to display, see <a href="http://quilljs.com/docs/formats/">here</a> for available options.</td>
</tr>

<tr>
<td>modules</td>
<td>any</td>
<td>null</td>
<td>Modules configuration of Editor, see <a href="https://quilljs.com/docs/modules/">here</a> for available options.</td>
</tr>
<tr>
<td>debug</td>
<td>string</td>
<td>null</td>
<td>Shortcut for debug. Note debug is a static method and will affect other instances of Quill
editors on the page. Only warning and error messages are enabled by default.</td>
</tr>
<tr>
<td>bounds</td>
<td>Element</td>
<td>document.body</td>
<td>DOM Element or a CSS selector for a DOM Element, within which the editor’s ui elements (i.e. tooltips, etc.) should be confined. Currently, it only considers left and right boundaries..</td>
</tr>
<tr>
<td>scrollingContainer</td>
<td>Element</td>
<td>null</td>
<td>DOM Element or a CSS selector for a DOM Element, specifying which container has the scrollbars (i.e. overflow-y: auto), if is has been changed from the default ql-editor with custom CSS.
Necessary to fix scroll jumping bugs when Quill is set to auto grow its height, and another ancestor container is responsible from the scrolling..</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit c63270a

Please sign in to comment.