Hi, When I use Summernote for a simple example, with just a simple annotation of a field, everything works fine,
Just adding the annotation @SummernoteEditor(height = 100, maxHeight = 300) to the field. However, when the same annotation is used for an object that is used in a list, updating the object does not work any more: (However, it still shows the colour correctly.) The database update statement is not being run: UPDATE freetext SET plainregulationtext=<'The captain has a green vessel with 3 liferafts.'>, version=<8> WHERE id=<1>, as an example, is not run. Another strange thing is that in the list, the label (the name) of the field is shown as part of the field value! In this example: Annotated Text is the name of the field, but in the list view it is listed as the value. When the object itself is listed, this does not happen, and everything is shown OK. [cid:[email protected]] Med vennlig hilsen / Best regards, Marianne Hagaseth Forsker – Maritime transportsystemer Research Scientist – Maritime Transport Systems MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS) Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway Mobile: +47 90 95 64 69 - Phone: +47 464 15 000 Web: www.marintek.sintef.no -----Original Message----- From: Marianne Hagaseth [mailto:[email protected]] Sent: 23. mars 2016 09:37 To: [email protected] Subject: FW: Summernote and list view And in addition to this: For the more complex example that does not work, the UPDATE is not run when pressing OK to save the editions done... Trying without summernoteEditor gives in the log: 09:33:48,261 [Native qtp551734240-14 DEBUG] UPDATE freetext SET plainregulationtext=<'The captain has a green vessel with 3 liferafts.'>, version=<8> WHERE id=<1> Best, Marianne. Also, It works OK when having a summernote-annotated field in a simple object, but not when this object is part of a collection. Then, the label of the field (the name) is copied to the field value. Med vennlig hilsen / Best regards, Marianne Hagaseth Forsker – Maritime transportsystemer Research Scientist – Maritime Transport Systems MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS) Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway Mobile: +47 90 95 64 69 - Phone: +47 464 15 000 Web: www.marintek.sintef.no<http://www.marintek.sintef.no> -----Original Message----- From: Marianne Hagaseth [mailto:[email protected]] Sent: 22. mars 2016 16:10 To: [email protected]<mailto:[email protected]> Subject: FW: Summernote and list view Does this help? Wicket.Ajax: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: TypeError: $(...).code is not a function, text: (function(){;(function() { var summernoteConfig = {"ToolbarOptions":{"Style":["style","fontname","fontsize","color","bold","italic","underline","strikethrough","clear"],"Layout":["ul","ol","paragraph","height"],"Insert":["link","video","table","hr"],"Misc":["fullscreen","codeview","undo","redo","help"]},"overlayTimeout":2000,"maxFilesize":2097152,"airMode":false,"height":100,"maxHeight":300,"force":false,"imageUploadUrl":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-leftColumn-memberGroup-1-properties-3-property-fragment-editor","summernoteEditorId":"editor300"}; var summernote = $('#'+summernoteConfig.summernoteEditorId); var toolbar = []; $.each(summernoteConfig.ToolbarOptions, function(key, value) { var category = []; category.push(key); category.push(value); toolbar.push(category); }); var summernoteConfigDefault = { toolbar : toolbar, onImageUpload : function(files) { var files = $(files); var filesSize = files.length; var overlay; // Show Overlay var overlayTimeout = setTimeout(function() { overlay = $("<div class='summernoteOverlay'></div>").appendTo("body"); new Spinner({color:'#fff'}).spin(overlay[0]); }, summernoteConfig.overlayTimeout); files.each(function() { var file = this; var data = new FormData(); data.append("file", file); url = summernoteConfig.imageUploadUrl; $.ajax({ data : data, headers : { "Wicket-Ajax" : "true", "Wicket-Ajax-BaseURL" : Wicket.Ajax.baseUrl }, type : "POST", url : url, cache : false, contentType : false, processData : false, success : function(res, status, xhr) { // Insert image var imageUrl = xhr.getResponseHeader("imageUrl"); var decodedImageUrl = window.atob(/(image=)(.*)[^&]*/.exec(imageUrl)[2]); imageUrl = imageUrl.replace(/(image=)[^&]*/, '$1' + decodedImageUrl); $('#'+summernoteConfig.summernoteEditorId).summernote('insertImage', imageUrl); // Hide Overlay filesSize -= 1; if (!filesSize) { clearTimeout(overlayTimeout); if(overlay) { overlay.remove(); } } } }); }); } }; $.extend(summernoteConfigDefault, summernoteConfig); summernote.summernote(summernoteConfigDefault); })(); })();(function(){$('#editor300').summernote('code', 'The <span style=\"background-color: rgb(255, 255, 0);\">captain</span> has a green <span style=\"background-color: rgb(0, 255, 0);\">ship</span> with 3 <span style=\"background-color: rgb(255, 255, 0);\">liferafts</span><br>')})();(function(){debugger;$('#editor300').code('The <span style=\"background-color: rgb(255, 255, 0);\">captain</span> has a green <span style=\"background-color: rgb(0, 255, 0);\">ship</span> with 3 <span style=\"background-color: rgb(255, 255, 0);\">liferafts</span><br>')})();(function(){(function($) { $('#autoComplete301').select2({"formatNoMatches":function() { return 'No matches found';},"formatInputTooShort":function(input, min) { return min - input.length == 1 ? 'Please enter 1 more character' : 'Please enter {number} more characters'.replace('{number}', min - input.length); },"formatSelectionTooBig":function(limit) { return limit == 1 ? 'You can only select 1 item' : 'You can only select {limit} items'.replace('{limit}', limit); },"formatLoadMore":function() { return 'Loading more results...';},"formatSearching":function() { return 'Searching...';},"ajax":{"data":function(term, page) { return { term: term, page:page, 'wicket-ajax':true, 'wicket-ajax-baseurl':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; },"dataType":"json","quietMillis":100,"results":function(data, page) { return data; },"url":"./entity?8-IResourceListener-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-leftColumn-memberGroup-1-properties-4-property-scalarIfRegular-entityLink-autoComplete"}}); })(jQuery);})();(function(){(function($) { $('#autoComplete301').select2('data', {"id":"SOLASCHAPTER:5^2:ecompliance:","text":"EU DIRECTIVE 1 - ARTICLE 1"}); })(jQuery);})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-leftColumn-memberGroup-2-associatedActionLinksPanel-additionalLinkList-additionalLinkItem-0-additionalLink","e":"click","c":"additionalLink2cd","sp":"bubble"});})();(function(){Wicket.Ajax.ajax({"f":"entityProperties2ce","u":"./entity?8-1.IBehaviorListener.1-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-leftColumn-ok","e":"click","c":"ok2ec","sc":"leftColumn:ok","m":"POST"});})();(function(){Wicket.Ajax.ajax({"f":"entityProperties2ce","u":"./entity?8-1.IBehaviorListener.1-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-leftColumn-cancel","e":"click","c":"cancel2ed","sc":"leftColumn:cancel","m":"POST"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-1-collectionGroup-collection-collectionContents-collectionContents~1-table-topToolbars-toolbars-1-headers-5-header-orderByLink","e":"click","c":"orderByLink302"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-1-collectionGroup-collection-collectionContents-collectionContents~1-table-topToolbars-toolbars-1-headers-6-header-orderByLink","e":"click","c":"orderByLink303"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-1-collectionGroup-additionalLinks-additionalLinkList-additionalLinkItem-0-additionalLink","e":"click","c":"additionalLink2d2","sp":"bubble"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-1-collectionGroup-selectorDropdown-views-viewList-viewItem-0-viewLink","e":"click","c":"viewLink304"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-2-collectionGroup-collection-collectionContents-collectionContents~1-table-topToolbars-toolbars-1-headers-5-header-orderByLink","e":"click","c":"orderByLink305"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-2-collectionGroup-collection-collectionContents-collectionContents~1-table-topToolbars-toolbars-1-headers-6-header-orderByLink","e":"click","c":"orderByLink306"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-2-collectionGroup-additionalLinks-additionalLinkList-additionalLinkItem-0-additionalLink","e":"click","c":"additionalLink2d6","sp":"bubble"});})();(function(){Wicket.Ajax.ajax({"u":"./entity?8-1.IBehaviorListener.0-theme-entityPageContainer-entity-entity~0-entityPropertiesAndCollections-entityProperties-entityCollections-collections-2-collectionGroup-selectorDropdown-views-viewList-viewItem-0-viewLink","e":"click","c":"viewLink307"});})(); wicket-ajax-jquery-ver-1450795700084.js:234:5 Med vennlig hilsen / Best regards, Marianne Hagaseth Forsker – Maritime transportsystemer Research Scientist – Maritime Transport Systems MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS) Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway Mobile: +47 90 95 64 69 - Phone: +47 464 15 000 Web: www.marintek.sintef.no<http://www.marintek.sintef.no/<http://www.marintek.sintef.no%3chttp:/www.marintek.sintef.no/>> From: Marianne Hagaseth [mailto:[email protected]] Sent: 21. mars 2016 21:36 To: [email protected]<mailto:[email protected]> Subject: Summernote and list view Hi! The AnnotatedText field is annoated with @SummernoteEditor(height = 100, maxHeight = 300) But something strange happens when the object is listed in a collection/sortedSet: The Field label is repeated in the field itself. Do you know why this happens? Also, it fails when I press Edit and then OK, even if no changes to the object has been done. [cid:[email protected]] Med vennlig hilsen / Best regards, Marianne Hagaseth Forsker – Maritime transportsystemer Research Scientist – Maritime Transport Systems MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS) Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway Mobile: +47 90 95 64 69 - Phone: +47 464 15 000 Web: www.marintek.sintef.no<http://www.marintek.sintef.no<http://www.marintek.sintef.no%3chttp:/www.marintek.sintef.no>> -----Original Message----- From: Martin Grigorov [mailto:[email protected]] Sent: 25. januar 2016 21:20 To: users Subject: Re: Summernote and Code view? Hello Marianne, On Mon, Jan 25, 2016 at 6:30 PM, Marianne Hagaseth < [email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>> wrote: > Hi, > Thanks a lot for this summernote editor integration! > https://github.com/isisaddons/isis-wicket-summernote > > Just two questions: > > 1) How do I enter the code view text to the domain property? For > instance, I want to set a String property of a Domain object to for > instance " <span style="background-color: inherit;"><span > style="background-color: yellow;"> </span><span style="background-color: yellow;"><br></span>". The result of > this then should be that the words 'Passenger ships' are highlighted > in yellow. > In your domain object you have to add a property like: https://github.com/isisaddons/isis-wicket-summernote/blob/a351bd07d9ae2c059a3d4275c1b9c84e696abf47/fixture/src/main/java/org/isisaddons/wicket/summernote/fixture/dom/SummernoteEditorToDoItem.java#L392-L402 i.e. a String property annotated with @SummernoteEditor The value of this String property is HTML snippet like the one you mentioned above. I'd generate it the first time with Summernote itself. I just did it for you at http://wb-mgrigorov.rhcloud.com/summernote and it produced: <span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; line-height: normal;"><span style="background-color: yellow;">Passenger ships</span> have more than 12 passengers.</span> If you set this HTML as initial value for the property then it will render as you want it. > > 2) Is it possible to have more than one domain property annotated > with summernote in one page/Domain object? > Sure. There is no limit in the number of Summernote editors in the page. > > Med vennlig hilsen / Best regards, > Marianne Hagaseth > Forsker - Maritime transportsystemer > Research Scientist - Maritime Transport Systems > > MARINTEK (Norsk Marinteknisk Forskningsinstitutt AS) > Address: POB 4125 Valentinlyst, NO-7450 Trondheim, Norway > Mobile: +47 90 95 64 69 - Phone: +47 464 15 000 > Web: > www.marintek.sintef.no<http://www.marintek.sintef.no/<http://www.marintek.sintef.no%3chttp:/www.marintek.sintef.no/<http://www.marintek.sintef.no%3chttp:/www.marintek.sintef.no/%3chttp:/www.marintek.sintef.no%3chttp:/www.marintek.sintef.no/>>> > >
