Просмотр исходного кода

ensure to be able to move/resize row and column

Yuki Takei 7 лет назад
Родитель
Сommit
2231eeda1a

+ 5 - 6
src/client/js/components/PageEditor/HandsontableModal.jsx

@@ -107,6 +107,10 @@ export default class HandsontableModal extends React.Component {
       height: 300,
       rowHeaders: true,
       colHeaders: true,
+      manualRowMove: true,
+      manualRowResize: true,
+      manualColumnMove: true,
+      manualColumnResize: true,
       contextMenu: {
         items: {
           'row_above': {}, 'row_below': {}, 'col_left': {}, 'col_right': {},
@@ -140,12 +144,7 @@ export default class HandsontableModal extends React.Component {
       },
       selectionMode: 'multiple',
       modifyColWidth: function(width) {
-        if (width < 100) {
-          return 100;
-        }
-        if (width > 300) {
-          return 300;
-        }
+        return Math.max(80, Math.min(400, width));
       }
     };
   }

+ 6 - 0
src/client/styles/scss/_handsontable.scss

@@ -11,3 +11,9 @@
 .handsontable-modal.modal-lg {
   width: 90%;
 }
+
+// Prevent handsontable/handsontable #2937 (Manual column resize does not work when handsontable is loaded inside Bootstrap 3.0 Modal)
+// see https://github.com/handsontable/handsontable/issues/2937#issuecomment-287390111
+.modal.in .modal-dialog.handsontable-modal {
+  transform: none;
+}