Skip to content

Commit

Permalink
Add plone.app.widgets support for tile rich text
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Jan 12, 2016
1 parent 3b52cc6 commit 9af6cee
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ There's a frood who really knows where his towel is.
1.0a13 (unreleased)
^^^^^^^^^^^^^^^^^^^

- If mockup is present and new widgets are used, call the scan function from
the mockup-registry to initialize them.
[frapell, rodfersou]

- Implement drag and drop among tiles (closes `#487`_).
[rodfersou]

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
'plone.app.tiles',
'plone.app.uuid',
'plone.app.vocabularies',
'plone.app.widgets',
'plone.autoform',
'plone.behavior',
'plone.dexterity',
Expand Down
46 changes: 33 additions & 13 deletions src/collective/cover/static/js/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,40 @@ $(document).ready(function() {
},
config: {
onLoad: function() {
if (typeof initTinyMCE != 'undefined') {
initTinyMCE(this.getOverlay());
}
$('textarea.mce_editable').each(function() {
if (typeof TinyMCEConfig != 'undefined') {
textarea_id = $(this).attr('id');
var config = new TinyMCEConfig(textarea_id);
delete InitializedTinyMCEInstances[textarea_id];
config.init();

// Remove unecessary link, use HTML button of editor
$('div.suppressVisualEditor').remove();
// In case plone.app.widgets is installed, we want to initialize patterns
// like for instance, TinyMCE
try {
if (tinyMCE.activeEditor !== null) {
tinyMCE.activeEditor.destroy();
}
$('.overlay textarea.mce_editable').addClass('pat-tinymce');
require('pat-registry').scan($('.overlay'), ['tinymce']);
$( '.overlay input#buttons-save').on('click', function() {
tinyMCE.triggerSave();
});
// Apparently JS devs love to z-index always at 9999. This conflicts
// with TinyMCE overlays
$('.overlay').on('mouseover', function() {
$('div.plone-modal-wrapper').css('z-index', '10050');
});
} catch (error) {
// If we are here it most probably means we don't have
// plone.app.widgets, so just ignore and continue
if (typeof initTinyMCE != 'undefined') {
initTinyMCE(this.getOverlay());
}
});
$('textarea.mce_editable').each(function() {
if (typeof TinyMCEConfig != 'undefined') {
textarea_id = $(this).attr('id');
var config = new TinyMCEConfig(textarea_id);
delete InitializedTinyMCEInstances[textarea_id];
config.init();

// Remove unecessary link, use HTML button of editor
$('div.suppressVisualEditor').remove();
}
});
}

//carousel
var carousel = $('div[data-carousel="carousel-sort"]');
Expand Down
1 change: 1 addition & 0 deletions versions-4.3.x.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
collective.js.bootstrap = 2.3.1.1
plone.app.blocks = 2.2.0
plone.app.tiles = 1.0.1
plone.app.widgets = 1.8.0

# for testing compatibility with newer versions of jQuery
plone.app.jquery = 1.7.2
Expand Down

0 comments on commit 9af6cee

Please sign in to comment.