Final Update From Caleb
Incorporated all Caleb's changes
This commit is contained in:
@@ -12,22 +12,32 @@ Template.AppreciationEditor.onRendered(function() {
|
||||
let _this = this;
|
||||
|
||||
//#appreciationEditor'
|
||||
CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
_this.ckEditor = editor;
|
||||
// CKEditor.create(document.querySelector('#editor'), {}).then(editor => {
|
||||
// _this.ckEditor = editor;
|
||||
//
|
||||
// Tracker.autorun(function() {
|
||||
// let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
//
|
||||
// originalData = (doc === undefined ? "" : doc.html);
|
||||
// editor.setData(originalData);
|
||||
// });
|
||||
// }).catch(err => {
|
||||
// console.error(err);
|
||||
// });
|
||||
$('.editor').tinymce({
|
||||
inline: true
|
||||
});
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
|
||||
Tracker.autorun(function() {
|
||||
let doc = Meteor.collections.Pages.findOne({name: 'Appreciation'});
|
||||
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
editor.setData(originalData);
|
||||
});
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
originalData = (doc === undefined ? "" : doc.html);
|
||||
$('.editor').html(originalData);
|
||||
});
|
||||
});
|
||||
|
||||
Template.AppreciationEditor.onDestroyed(function() {
|
||||
let data = this.ckEditor.getData();
|
||||
// let data = this.ckEditor.getData();
|
||||
let data = $('.editor').html();
|
||||
|
||||
if(data != originalData) {
|
||||
swal({
|
||||
@@ -62,7 +72,8 @@ Template.AppreciationEditor.helpers({
|
||||
|
||||
Template.AppreciationEditor.events({
|
||||
'click #save': function(event, template) {
|
||||
let data = template.ckEditor.getData();
|
||||
// let data = template.ckEditor.getData();
|
||||
let data = $('.editor').html();
|
||||
|
||||
if(data != originalData) {
|
||||
Meteor.call('updatePage', 'Appreciation', data, function (error, result) {
|
||||
|
||||
Reference in New Issue
Block a user