Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #502 from InfyOmLabs/jenil/quill_editor_toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaileshInfyom authored Aug 1, 2020
2 parents ac6448b + 1631e46 commit 2b31b1f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
26 changes: 26 additions & 0 deletions resources/assets/js/task/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,39 @@ $(document).on('click', '.entry-model', function (event) {
}, 1500);
})

const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],

[{ 'header': 1 }, { 'header': 2 }],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }],
[{ 'indent': '-1'}, { 'indent': '+1' }],
[{ 'direction': 'rtl' }],

[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],

[{ 'color': [] }, { 'background': [] }],
[{ 'font': [] }],
[{ 'align': [] }],

['clean']
];

// quill editor initialization scripts
let quill = new Quill('#taskDescriptionContainer', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: 'Add task description...',
});

let quillEdit = new Quill('#taskEditDescriptionContainer', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: 'Add task description...',
});
Expand Down
29 changes: 29 additions & 0 deletions resources/assets/js/task/task_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,26 @@ $(document).on('click', '.comment-display,.edit-comment', function () {
$('.comment-cancel-icon-' + commentId).removeClass('d-none');
})

const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],

[{ 'header': 1 }, { 'header': 2 }],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }],
[{ 'indent': '-1'}, { 'indent': '+1' }],
[{ 'direction': 'rtl' }],

[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],

[{ 'color': [] }, { 'background': [] }],
[{ 'font': [] }],
[{ 'align': [] }],

['clean']
];

/*
- This method will create separate Quill Editor instance (but only once, then after it will use the existing created one) when some
one will edit the comment.
Expand All @@ -503,6 +523,9 @@ window.setCommentEditData = function (commentId) {
// create new Quill Editor instance
quillCommentEdit[commentId] = new Quill('#commentEditContainer' + commentId,
{
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: 'Add task description...',
});
Expand Down Expand Up @@ -553,11 +576,17 @@ $(document).on('mouseleave', '.comments__information', function () {

// quill editor initialization scripts
let quillComment = new Quill('#commentContainer', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: 'Add comment...',
});

let quillTask = new Quill('#taskEditDescriptionContainer', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: 'Add task description...',
});
Expand Down

0 comments on commit 2b31b1f

Please sign in to comment.