This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 9661ed8  Making summernote usable and adding data lists to image and 
file selection
9661ed8 is described below

commit 9661ed85faf7ad6a4828512d881d853cc898c9c4
Author: Dan Klco <[email protected]>
AuthorDate: Wed Feb 7 17:33:54 2018 -0500

    Making summernote usable and adding data lists to image and file selection
---
 cms/ui/src/main/frontend/src/js/scripts.js             | 16 +++++++++++++++-
 cms/ui/src/main/frontend/src/scss/styles.scss          |  4 ++++
 .../etc/clientlibs/sling-cms-editor/editor.css         |  4 ++--
 .../components/editor/fields/richtext/field.jsp        | 18 +++++++++++++++++-
 .../components/editor/slingform/slingform.jsp          |  1 +
 5 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/cms/ui/src/main/frontend/src/js/scripts.js 
b/cms/ui/src/main/frontend/src/js/scripts.js
index 292bb5f..ee041ed 100644
--- a/cms/ui/src/main/frontend/src/js/scripts.js
+++ b/cms/ui/src/main/frontend/src/js/scripts.js
@@ -250,8 +250,22 @@ Sling.CMS = {
                                    ['misc', ['codeview', 'undo','redo','help']]
                                ],
                                dialogsInBody: true,
-                               height: 200
+                               height: 200,
+                           onCreateLink: function (url) {
+                               return url;
+                           },
+                           callbacks: {
+                                       onDialogShown: function(e){
+                                               
$('.note-link-url').attr('list','richtext-pages');
+                                               
$('.note-image-url').attr('list','richtext-images');
+                                       }
+                           }
+                       }).on('summernote.dialog.shown', function(e) {
+                         console.log('Dialog shown!');
+                       }).on('summernote.keydown', function(we, e) {
+                                 console.log('Key is downed:', e.keyCode);
                        });
+;
                }
        }
 
diff --git a/cms/ui/src/main/frontend/src/scss/styles.scss 
b/cms/ui/src/main/frontend/src/scss/styles.scss
index 38b46db..b8104c4 100644
--- a/cms/ui/src/main/frontend/src/scss/styles.scss
+++ b/cms/ui/src/main/frontend/src/scss/styles.scss
@@ -119,6 +119,10 @@ ul.Breadcrumb  {
        background-color: lightgray;
 }
 
+.note-group-select-from-files {
+  display: none;
+}
+
 .Pull-Right {
        float:right;
 }
diff --git 
a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.css 
b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.css
index 933bbc9..cb1b90a 100644
--- 
a/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.css
+++ 
b/cms/ui/src/main/resources/jcr_root/etc/clientlibs/sling-cms-editor/editor.css
@@ -70,13 +70,13 @@
     margin: 3em auto; 
     padding: 2em;
     border: 1px solid gray;
-    width: 60%; 
+    width: 85%; 
     z-index: 1;
 }
 
 .Sling-CMS__modal-frame-container {
     position: relative;
-    padding-bottom: 56.25%; 
+    padding-bottom: 80%; 
     padding-top: 30px;
     height: 0;
     overflow: hidden;
diff --git 
a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/richtext/field.jsp
 
b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/richtext/field.jsp
index 9095ca5..b651230 100644
--- 
a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/richtext/field.jsp
+++ 
b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/fields/richtext/field.jsp
@@ -17,4 +17,20 @@
  * under the License.
  */ --%>
  <%@include file="/libs/sling-cms/global.jsp"%>
-<textarea class="richtext" name="${properties.name}" ${required} 
${disabled}>${editProperties[properties.name]}</textarea>
\ No newline at end of file
+<textarea class="richtext" name="${properties.name}" ${required} 
${disabled}>${editProperties[properties.name]}</textarea>
+<c:set var="pageQuery" value="SELECT * FROM [sling:Page] AS s WHERE 
ISDESCENDANTNODE([${sling:getAbsoluteParent(slingRequest.requestPathInfo.suffixResource,2).path}])"
 />
+<c:set var="imageQuery" value="SELECT * FROM [sling:File] AS s WHERE 
ISDESCENDANTNODE([${sling:getAbsoluteParent(slingRequest.requestPathInfo.suffixResource,2).path}])
 AND [jcr:content/jcr:mimeType] LIKE 'image/%'" />
+<datalist id="richtext-pages">
+       <c:forEach var="page" 
items="${sling:findResources(resourceResolver,pageQuery,'JCR-SQL2')}">
+               <option value="${page.path}.html">
+                       <sling:encode 
value="${page.valueMap['jcr:content/jcr:title']}" mode="HTML" />
+               </option>
+       </c:forEach>
+</datalist>
+<datalist id="richtext-images">
+       <c:forEach var="image" 
items="${sling:findResources(resourceResolver,imageQuery,'JCR-SQL2')}">
+               <option value="${image.path}">
+                       <sling:encode 
value="${image.valueMap['jcr:content/jcr:title']}" mode="HTML" 
default="${image.name }" />
+               </option>
+       </c:forEach>
+</datalist>
\ No newline at end of file
diff --git 
a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
 
b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
index 8e58d38..c360e16 100644
--- 
a/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
+++ 
b/cms/ui/src/main/resources/jcr_root/libs/sling-cms/components/editor/slingform/slingform.jsp
@@ -18,6 +18,7 @@
  */ --%>
  <%@include file="/libs/sling-cms/global.jsp"%>
 <form method="post" 
action="${slingRequest.requestPathInfo.suffix}${properties.actionSuffix}" 
enctype="multipart/form-data" class="Form-Ajax" 
data-add-date="${properties.addDate != false}">
+       <input type="hidden" name="_charset_" value="utf-8" />
        <sling:include path="fields" 
resourceType="sling-cms/components/general/container" />
        <div class="Field-Group">
                <button type="submit" class="btn btn-success" 
title="<sling:encode value="${properties.button}" mode="HTML_ATTR" />">

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to