Skip to content

Commit

Permalink
small changes for django content app
Browse files Browse the repository at this point in the history
  • Loading branch information
enverbisevac committed Mar 2, 2014
1 parent 15a5343 commit 6a99e40
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 17 deletions.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include README.md
include MANIFEST.in
recursive-include ckeditor_filer/templates *
recursive-include ckeditor_filer/static *
recursive-include ckeditor_filer/locale *
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
dialog = CKEDITOR.dialog.getCurrent();
var imageWidth = 0;
var imageHeight = 0;

function getImageUrl() {
var url = dialog.getContentElement("tab-basic", "url");
var thumb_opt_id = "";
Expand Down Expand Up @@ -34,7 +34,7 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
// document = CKEDITOR.dom.document
var id_image = document.getById( 'id_image' );
var oldVal = id_image.getValue();

setInterval(function () {
if (oldVal != id_image.getValue()) {
oldVal = id_image.getValue();
Expand All @@ -44,7 +44,7 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
if ( id_image )
id_image.hide();
var id_image_clear = document.getById( 'id_image_clear' );

id_image_clear.on('click', function () {
id_image.setValue("");
id_image.removeAttribute("value");
Expand Down Expand Up @@ -76,7 +76,7 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
else
this.insertMode = false;

// Store the reference to the <abbr> element in an internal property, for later use.
// Store the reference to the <img> element in an internal property, for later use.
this.element = element;

// Invoke the setup methods of all dialog elements, so they can load the element attributes.
Expand All @@ -87,20 +87,25 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
},
// This method is invoked once a user clicks the OK button, confirming the dialog.
onOk: function() {

// The context of this function is the dialog object itself.
// http://docs.ckeditor.com/#!/api/CKEDITOR.dialog
var dialog = this;

// Creates a new <abbr> element.
var abbr = this.element;
// Creates a new <img> element.
var img = this.element;

dialog = CKEDITOR.dialog.getCurrent();
var document = this.getElement().getDocument();
// document = CKEDITOR.dom.document
var id_image = document.getById( 'id_image' );
img.setAttribute("filer_id", id_image.getValue());

// Invoke the commit methods of all dialog elements, so the <abbr> element gets modified.
this.commitContent( abbr );
// Invoke the commit methods of all dialog elements, so the <img> element gets modified.
this.commitContent( img );

// Finally, in if insert mode, inserts the element at the editor caret position.
if ( this.insertMode )
editor.insertElement( abbr );
editor.insertElement( img );
},

contents: [
Expand Down Expand Up @@ -194,7 +199,7 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
}
});
},
onChange: function() {
Expand Down Expand Up @@ -223,7 +228,7 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
ratio = this.getValue() / imageWidth; // get ratio for scaling image
dialog.getContentElement("tab-basic", "height").setValue(Math.ceil(imageHeight * ratio));
}

//getImageUrl();
},
setup: function( element ) {
Expand Down Expand Up @@ -286,9 +291,27 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
}
},
{
type: 'checkbox',
id: 'target_blank',
label: 'Target blank',
type: 'hbox',
widths: [ '33%', '33%', '33%' ],
children: [
{
type: 'checkbox',
id: 'target_blank',
label: 'Target blank',
},
{
type: 'checkbox',
id: 'front_image',
label: 'Front image',
setup: function( element ) {
this.setValue( element.getAttribute( "front_image" ) );
},
// Called by the main commitContent call on dialog confirmation.
commit: function( element ) {
element.setAttribute( "front_image", this.getValue() );
}
}
]
},
]
},
Expand All @@ -305,4 +328,4 @@ CKEDITOR.dialog.add( 'filerImageDialog', function ( editor ) {
}
]
};
});
});
2 changes: 1 addition & 1 deletion ckeditor_filer/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
['Source', '-', 'Bold', 'Italic']
],
'toolbar_Full': [
['Styles', 'Format', 'Bold', 'Italic', 'Underline', 'Strike', 'SpellChecker', 'Undo', 'Redo'],
['Paragraph', 'Styles', 'Format', 'Bold', 'Italic', 'Underline', 'Strike', 'SpellChecker', 'Undo', 'Redo'],
['Filer Image', 'Table', 'HorizontalRule'],
['TextColor', 'BGColor'],
['Smiley', 'SpecialChar'], ['Source'],
Expand Down

0 comments on commit 6a99e40

Please sign in to comment.