浏览代码

[spark] i18n medium editor and style fixes

Enrico Berti 10 年之前
父节点
当前提交
abd287d

+ 8 - 4
apps/spark/src/spark/templates/editor.mako

@@ -586,8 +586,8 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
       </div>
 
       <div data-bind="visible: type() == 'text'">
-        <div data-bind="html: statement_raw, visible: ! $root.isEditing()"></div>
-        <div data-bind="attr:{'id': 'editor_'+id()}, html: statement_raw, value: statement_raw, medium: {}, visible: $root.isEditing()"></div>
+        <div data-bind="html: statement_raw, visible: ! $root.isEditing()" class="text-snippet"></div>
+        <div data-bind="attr:{'id': 'editor_'+id()}, html: statement_raw, value: statement_raw, medium: {}, visible: $root.isEditing()" class="text-snippet"></div>
       </div>
     </div>
   </div>
@@ -627,9 +627,13 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
   ko.bindingHandlers.medium = {
     init: function (element, valueAccessor, allBindings) {
         var editor = new MediumEditor($(element), {
-          buttons: ['bold', 'italic', 'underline', 'quote', 'anchor', 'orderedlist', 'unorderedlist', 'pre', 'outdent', 'indent'],
+          buttons: ['header1', 'header2', 'bold', 'italic', 'underline', 'quote', 'anchor', 'orderedlist', 'unorderedlist', 'pre', 'outdent', 'indent'],
           buttonLabels: 'fontawesome',
-          anchorTarget: true
+          anchorTarget: true,
+          anchorInputPlaceholder: '${ _("Paste or type a link") }',
+          anchorInputCheckboxLabel: '${ _("Open in new window") }',
+          firstHeader: 'h2',
+          secondHeader: 'h3'
       });
       $(element).on('input', function() {
         allBindings().value($(element).html())

+ 1 - 1
apps/spark/src/spark/views.py

@@ -47,7 +47,7 @@ def editor(request):
               'python': _('Example: 1 + 1, or press CTRL + space'),
               'impala': _('Example: SELECT * FROM tablename, or press CTRL + space'),
               'hive': _('Example: SELECT * FROM tablename, or press CTRL + space'),
-              'text': _('<h1>Cool!</h1>That is so cool')
+              'text': _('<h2>This is a text snippet</h2>Type your text here')
           }
       })
   })

+ 14 - 0
apps/spark/static/css/spark.css

@@ -178,6 +178,10 @@
   outline:none;
 }
 
+.text-snippet h2 {
+  padding-left: 0!important;
+}
+
 .span12.nomargin {
   margin-left: 0;
 }
@@ -245,3 +249,13 @@ h1.empty {
 .progress, .progress-neutral .bar {
   background-color: #DDD;
 }
+
+.medium-editor-toolbar-form label {
+  min-height: 20px;
+}
+
+.medium-editor-toolbar-form input[type="checkbox"] {
+  float: left;
+  margin-left: 0;
+  margin-right: 4px;
+}

文件差异内容过多而无法显示
+ 0 - 0
desktop/core/static/ext/js/medium-editor.min.js


部分文件因为文件数量过多而无法显示