Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine87b43b38efe3
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.html b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.html
index 71a805cfa3..0c08f5647d 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.html
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.html
@@ -14,12 +14,13 @@
<div wicket:id="attachments"></div>
</div>
<wicket:fragment wicket:id="attachmentsFrag">
+ <wicket:enclosure child="attachments">
<ul class="attachments list-unstyled">
<li wicket:id="attachments" class="attachment selectable">
<a wicket:id="link"></a>
</li>
</ul>
- <div wicket:id="noAttachments" class="no-attachments">No uploaded files</div>
+ </wicket:enclosure>
<form wicket:id="form">
<div wicket:id="feedback" class="feedback"></div>
<span class="btn btn-default btn-file">
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java
index 411f69bbbf..c0e43b97ed 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/SelectUrlPanel.java
@@ -114,7 +114,7 @@ class SelectUrlPanel extends Panel {
final Fragment fragment = new Fragment("attachments", "attachmentsFrag", this);
fragment.setOutputMarkupId(true);
- final IModel<List<String>> attachmentsModel = new LoadableDetachableModel<List<String>>() {
+ fragment.add(new ListView<String>("attachments", new LoadableDetachableModel<List<String>>() {
@Override
protected List<String> load() {
@@ -126,8 +126,7 @@ class SelectUrlPanel extends Panel {
return attachmentNames;
}
- };
- fragment.add(new ListView<String>("attachments", attachmentsModel) {
+ }) {
@Override
protected void populateItem(final ListItem<String> item) {
@@ -153,15 +152,11 @@ class SelectUrlPanel extends Panel {
}.setEscapeModelStrings(false));
}
-
- });
- fragment.add(new WebMarkupContainer("noAttachments") {
@Override
protected void onConfigure() {
super.onConfigure();
-
- setVisible(attachmentsModel.getObject().isEmpty());
+ setVisible(!getModelObject().isEmpty());
}
});
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/bootstrap-markdown.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/bootstrap-markdown.js
index 54c65c376f..cb212cabb1 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/bootstrap-markdown.js
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/bootstrap-markdown.js
@@ -916,7 +916,7 @@
name: 'groupFont',
data: [{
name: 'cmdBold',
- hotkey: 'Ctrl+B',
+ hotkey: 'Alt+B',
title: 'Bold',
icon: { glyph: 'glyphicon glyphicon-bold', fa: 'fa fa-bold', 'fa-3': 'icon-bold' },
callback: function(e){
@@ -947,7 +947,7 @@
},{
name: 'cmdItalic',
title: 'Italic',
- hotkey: 'Ctrl+I',
+ hotkey: 'Alt+I',
icon: { glyph: 'glyphicon glyphicon-italic', fa: 'fa fa-italic', 'fa-3': 'icon-italic' },
callback: function(e){
// Give/remove * surround the selection
@@ -977,7 +977,7 @@
},{
name: 'cmdHeading',
title: 'Heading',
- hotkey: 'Ctrl+H',
+ hotkey: 'Alt+H',
icon: { glyph: 'glyphicon glyphicon-header', fa: 'fa fa-header', 'fa-3': 'icon-font' },
callback: function(e){
// Append/remove ### surround the selection
@@ -1014,7 +1014,7 @@
data: [{
name: 'cmdUrl',
title: 'URL/Link',
- hotkey: 'Ctrl+L',
+ hotkey: 'Alt+L',
icon: { glyph: 'glyphicon glyphicon-link', fa: 'fa fa-link', 'fa-3': 'icon-link' },
callback: function(e){
// Give [] surround the selection and prepend the link
@@ -1043,7 +1043,7 @@
},{
name: 'cmdImage',
title: 'Image',
- hotkey: 'Ctrl+G',
+ hotkey: 'Alt+G',
icon: { glyph: 'glyphicon glyphicon-picture', fa: 'fa fa-picture-o', 'fa-3': 'icon-picture' },
callback: function(e){
// Give ![] surround the selection and prepend the image link
@@ -1077,7 +1077,7 @@
name: 'groupMisc',
data: [{
name: 'cmdList',
- hotkey: 'Ctrl+U',
+ hotkey: 'Alt+U',
title: 'Unordered List',
icon: { glyph: 'glyphicon glyphicon-list', fa: 'fa fa-list', 'fa-3': 'icon-list-ul' },
callback: function(e){
@@ -1123,7 +1123,7 @@
},
{
name: 'cmdListO',
- hotkey: 'Ctrl+O',
+ hotkey: 'Alt+O',
title: 'Ordered List',
icon: { glyph: 'glyphicon glyphicon-th-list', fa: 'fa fa-list-ol', 'fa-3': 'icon-list-ol' },
callback: function(e) {
@@ -1169,7 +1169,7 @@
},
{
name: 'cmdCode',
- hotkey: 'Ctrl+K',
+ hotkey: 'Alt+K',
title: 'Code',
icon: { glyph: 'glyphicon glyphicon-asterisk', fa: 'fa fa-code', 'fa-3': 'icon-code' },
callback: function(e) {
@@ -1208,7 +1208,7 @@
},
{
name: 'cmdQuote',
- hotkey: 'Ctrl+Q',
+ hotkey: 'Alt+Q',
title: 'Quote',
icon: { glyph: 'glyphicon glyphicon-comment', fa: 'fa fa-quote-left', 'fa-3': 'icon-quote-left' },
callback: function(e) {
@@ -1258,7 +1258,7 @@
data: [{
name: 'cmdPreview',
toggle: true,
- hotkey: 'Ctrl+P',
+ hotkey: 'Alt+P',
title: 'Preview',
btnText: 'Preview',
btnClass: 'btn btn-primary btn-sm',
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/markdown.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/markdown.js
index 93d47fb78e..b6e1b09aa9 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/markdown.js
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/markdown/markdown.js
@@ -34,16 +34,18 @@ pmease.commons.markdown = {
onShow: function(e) {
var $mdEditor = $input.closest(".md-editor");
$mdEditor.attr("tabindex", "0");
- $mdEditor.bind("keydown", "Ctrl+P", function(e) {
+ $mdEditor.bind("keydown", "Alt+P", function(e) {
$mdEditor.find(">.md-header .fa-search").parent().click();
e.preventDefault();
- });
+ e.stopPropagation();
+ });
$input.bind("keydown", "F11", function(e) {
if ($mdEditor.hasClass("md-fullscreen-mode"))
$mdEditor.find(".exit-fullscreen").click();
else
$mdEditor.find(".md-control-fullscreen").click();
e.preventDefault();
+ e.stopPropagation();
});
},
onFullscreen: function(e) {
@@ -89,7 +91,7 @@ pmease.commons.markdown = {
}, {
name: "cmdURL2",
title: "Image",
- hotkey: 'Ctrl+L',
+ hotkey: 'Alt+L',
icon: "fa fa-link",
callback: function(e){
onSelectUrl(false);
@@ -97,7 +99,7 @@ pmease.commons.markdown = {
}, {
name: "cmdImage2",
title: "Image",
- hotkey: 'Ctrl+G',
+ hotkey: 'Alt+G',
icon: "fa fa-picture-o",
callback: function(e){
onSelectUrl(true);
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
index a83763b264..52347806c0 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.html
@@ -1,11 +1,2 @@
<wicket:extend>
- <form>
- <input name="title" type="text" placeholder="Title?" />
- <textarea name="content" data-provide="markdown" rows="10"></textarea>
- <label class="checkbox"> <input name="publish" type="checkbox">
- Publish
- </label>
- <hr />
- <button type="submit" class="btn">Submit</button>
- </form>
</wicket:extend>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
index 1e833202f5..a2043b3c5b 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/test/TestPage.java
@@ -1,13 +1,7 @@
package com.pmease.gitplex.web.page.test;
-import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.request.resource.CssResourceReference;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import com.pmease.commons.wicket.assets.hotkeys.HotkeysResourceReference;
-import com.pmease.commons.wicket.behavior.markdown.MarkdownBehavior;
import com.pmease.gitplex.web.page.base.BasePage;
@SuppressWarnings("serial")
@@ -21,12 +15,6 @@ public class TestPage extends BasePage {
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
-
- response.render(JavaScriptHeaderItem.forReference(
- new JavaScriptResourceReference(MarkdownBehavior.class, "bootstrap-markdown.js")));
- response.render(JavaScriptHeaderItem.forReference(HotkeysResourceReference.INSTANCE));
- response.render(CssHeaderItem.forReference(
- new CssResourceReference(MarkdownBehavior.class, "bootstrap-markdown.min.css")));
}
}