app/assets/javascripts/cardboard/rich_text.js in cardboard_cms-0.1.4 vs app/assets/javascripts/cardboard/rich_text.js in cardboard_cms-0.1.6
- old
+ new
@@ -54,27 +54,39 @@
parserRules: wysihtml5ParserRules,
useLineBreaks: false
}
$(document).on("ready pjax:end", function(e){
- // console.log($(".wysihtml5").length);
if($(".wysihtml5").length) {
$('.wysihtml5').wysihtml5(rich_text_editor_defaults);
+ $('iframe.wysihtml5-sandbox').wysihtml5_size_matters();
+
+ // TODO: find a better way to handle multiple RTE on a single page
+ $(".bootstrap-wysihtml5-insert-link-modal .tab-content div").each(function (index) {
+ $(this).attr("id", $(this).attr("id") + index.toString());
+ });
+ $(".bootstrap-wysihtml5-insert-link-modal .nav li a").each(function (index) {
+ $(this).attr("href", $(this).attr("href") + index.toString());
+ if(index % 3 == 0) $(this).tab('show');
+ });
+ // END TODO
}
});
$(document).on('cocoon:after-insert', function(e, insertedItem) {
if($(insertedItem).find(".wysihtml5").length){
$(insertedItem).find(".wysihtml5").wysihtml5(rich_text_editor_defaults);
}
});
-$(document).on('click', '.bootstrap-wysihtml5-insert-link-modal #link_pages a', function(e){
- e.preventDefault;
+
+
+$(document).on('click', '.bootstrap-wysihtml5-insert-link-modal .link_pages a', function(e){
+ e.preventDefault();
+ console.log("clicked");
modal = $(this).closest(".bootstrap-wysihtml5-insert-link-modal");
modal.find("input.bootstrap-wysihtml5-insert-link-url").val($(this).data("url"));
modal.find("#insert_link").click();
- return false;
});
$(document).on('change', '.bootstrap-wysihtml5-insert-link-modal .tab-pane input', function(){
$(this).closest('.bootstrap-wysihtml5-insert-link-modal').find('.bootstrap-wysihtml5-insert-link-url').val($(this).val());
});