mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 09:09:59 +09:00
자동저장 및 복구 기능 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@8004 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4ba8af4ddc
commit
9e0fd13ad5
1 changed files with 19 additions and 9 deletions
|
|
@ -54,15 +54,12 @@ Xeed = xe.createApp('Xeed', {
|
||||||
|
|
||||||
//
|
//
|
||||||
if ($obj.is('textarea')) {
|
if ($obj.is('textarea')) {
|
||||||
$text = $obj;
|
$text = $obj;
|
||||||
content = $obj.val();
|
|
||||||
} else {
|
} else {
|
||||||
$text = $obj.before('<textarea>').hide().prev();
|
$text = $obj.before('<textarea>').hide().prev().val($obj.html());
|
||||||
content = $obj.html();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to wysiwyg editor
|
// Convert to wysiwyg editor
|
||||||
|
|
||||||
this.$textarea = $text;
|
this.$textarea = $text;
|
||||||
this.$root = $text.parent();
|
this.$root = $text.parent();
|
||||||
this.$richedit = this.$root.find('div.edit>div.xdcs:first');
|
this.$richedit = this.$root.find('div.edit>div.xdcs:first');
|
||||||
|
|
@ -137,8 +134,8 @@ Xeed = xe.createApp('Xeed', {
|
||||||
this.registerPlugin(new Clear);
|
this.registerPlugin(new Clear);
|
||||||
|
|
||||||
// set content
|
// set content
|
||||||
if (!$.browser.msie && !content) content = '<br />';
|
if (!$.browser.msie && !$text.val()) $text.val('<br />');
|
||||||
setTimeout(function(){ self.cast('SET_CONTENT', [content]) }, 0);
|
setTimeout(function(){ self.cast('SET_CONTENT', [$text.val()]) }, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -3121,7 +3118,7 @@ AutoSave = xe.createPlugin('AutoSave', {
|
||||||
|
|
||||||
init : function(){ },
|
init : function(){ },
|
||||||
activate : function(){
|
activate : function(){
|
||||||
var self = this, app = this.oApp, $form;
|
var self = this, app = this.oApp, $form, title, content;
|
||||||
|
|
||||||
// start time
|
// start time
|
||||||
this._start_time = (new Date).getTime();
|
this._start_time = (new Date).getTime();
|
||||||
|
|
@ -3131,11 +3128,24 @@ AutoSave = xe.createPlugin('AutoSave', {
|
||||||
this._enable = app.getOption('use_autosave');
|
this._enable = app.getOption('use_autosave');
|
||||||
|
|
||||||
this.$bar = this.oApp.$root.find('div.time').hide().click(function(){ $(this).slideUp(300) });
|
this.$bar = this.oApp.$root.find('div.time').hide().click(function(){ $(this).slideUp(300) });
|
||||||
|
$form = $(app.$textarea[0].form);
|
||||||
|
|
||||||
if (this._enable && window.editorEnableAutoSave) {
|
if (this._enable && window.editorEnableAutoSave) {
|
||||||
$form = $(app.$textarea[0].form);
|
|
||||||
editorEnableAutoSave($form[0], $form.attr('editor_sequence'), function(params){ self._save_callback(params) });
|
editorEnableAutoSave($form[0], $form.attr('editor_sequence'), function(params){ self._save_callback(params) });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restore saved content
|
||||||
|
title = $form[0]._saved_doc_title.value;
|
||||||
|
content = $form[0]._saved_doc_content.value;
|
||||||
|
|
||||||
|
if (title || content) {
|
||||||
|
if (confirm($form[0]._saved_doc_message.value)) {
|
||||||
|
$form.find('input[name=title]').val(title);
|
||||||
|
app.$textarea.val(content);
|
||||||
|
} else {
|
||||||
|
editorRemoveSavedDoc();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deactivate : function() {
|
deactivate : function() {
|
||||||
this.$bar.unbind();
|
this.$bar.unbind();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue