Browse Source

fix(feature): functionButton

1.fix functionButton 2.remove undefined request 3.add rangePasteBefore hook

fix #336 fix #381
master
dushusir 5 years ago
parent
commit
5983cb015e
  1. 10
      docs/guide/api.md
  2. 12
      docs/zh/guide/api.md
  3. 17
      src/controllers/constant.js
  4. 6
      src/controllers/handler.js
  5. 2
      src/css/luckysheet-core.css
  6. 3
      src/global/method.js
  7. 6
      src/index.html

10
docs/guide/api.md

@ -319,6 +319,16 @@ Use note:
Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format. Pay special attention to the setting of `range` in `setting` only when `isRange` is set to `true`, which is different from the general range format.
If you want to use this API to set the freeze after the workbook is initialized, you can execute it in the hook function after the workbook is created, such as:
```js
luckysheet.create({
hook:{
workbookCreateAfter:function(){
luckysheet.setBothFrozen(false);
}
}
});
- **Usage**: - **Usage**:
- Frozen ranks - Frozen ranks

12
docs/zh/guide/api.md

@ -320,6 +320,18 @@ Luckysheet针对常用的数据操作需求,开放了主要功能的API,开
冻结行列操作 冻结行列操作
特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。 特别注意,只有在`isRange`设置为`true`的时候,才需要设置`setting`中的`range`,且与一般的range格式不同。
如果想在工作簿初始化后使用此API设置冻结,可以在工作簿创建后的钩子函数中执行,比如:
```js
luckysheet.create({
hook:{
workbookCreateAfter:function(){
luckysheet.setBothFrozen(false);
}
}
});
```
- **示例**: - **示例**:

17
src/controllers/constant.js

@ -7,7 +7,7 @@ const gridHTML = function(){
const _locale = locale(); const _locale = locale();
const locale_info = _locale.info; const locale_info = _locale.info;
const locale_print = _locale.print; const locale_print = _locale.print;
const userInfo = luckysheetConfigsetting.userInfo === true ? '<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky' : luckysheetConfigsetting.userInfo; // When true, use the default HTML string const userInfo = luckysheetConfigsetting.userInfo === true ? '<i style="font-size:16px;color:#ff6a00;" class="fa fa-taxi" aria-hidden="true"></i> Lucky' : luckysheetConfigsetting.userInfo; // When true, use the default HTML string. The rendering of userInfo below uses nested template strings. Otherwise, when display is used and the image path is not passed in, there will be an undefined request
return `<div class="luckysheet"> return `<div class="luckysheet">
<canvas id="luckysheetTableContentF" style="display:none;" class="luckysheetTableContent"></canvas> <canvas id="luckysheetTableContentF" style="display:none;" class="luckysheetTableContent"></canvas>
@ -23,14 +23,15 @@ const gridHTML = function(){
<div id="luckysheet_info_detail_update" class="luckysheet_info_detail_update"> ${locale_info.detailUpdate} </div> <div id="luckysheet_info_detail_update" class="luckysheet_info_detail_update"> ${locale_info.detailUpdate} </div>
<div id="luckysheet_info_detail_save" class="luckysheet_info_detail_save"> ${locale_info.wait} </div> <div id="luckysheet_info_detail_save" class="luckysheet_info_detail_save"> ${locale_info.wait} </div>
<div class="luckysheet_info_detail_user" style="display:${getObjType(userInfo) === 'string' ? 'block' : 'none'};"> \${functionButton} \${functionButton}
<span id="luckysheet_info_detail_user">${userInfo}</span>
</div> ${getObjType(userInfo) === 'string' ? `<div class="luckysheet_info_detail_user">
<span id="luckysheet_info_detail_user">${userInfo}</span></div>` : ''}
<div class="luckysheet_info_detail_user" style="display:${getObjType(userInfo) === 'object' ? 'block' : 'none'};"> \${functionButton} ${getObjType(userInfo) === 'object' ? `<div class="luckysheet_info_detail_user">
<img src="${userInfo.userImage}" id="luckysheet_info_detail_user_img"> <img src="${userInfo.userImage}" id="luckysheet_info_detail_user_img">
<span id="luckysheet_info_detail_user">${userInfo.userName}</span> <span id="luckysheet_info_detail_user">${userInfo.userName}</span>
</div> </div>` : ''}
</div> </div>
<div id="luckysheet-wa-editor" class="luckysheet-wa-editor toolbar"> \${menu} </div> <div id="luckysheet-wa-editor" class="luckysheet-wa-editor toolbar"> \${menu} </div>

6
src/controllers/handler.js

@ -5294,6 +5294,12 @@ export default function luckysheetHandler() {
const locale_fontjson = locale().fontjson; const locale_fontjson = locale().fontjson;
// hook
if(!method.createHookFunction('rangePasteBefore',Store.luckysheet_select_save,txtdata)){
return;
}
if (txtdata.indexOf("luckysheet_copy_action_table") > - 1 && Store.luckysheet_copy_save["copyRange"] != null && Store.luckysheet_copy_save["copyRange"].length > 0 && isEqual) { if (txtdata.indexOf("luckysheet_copy_action_table") > - 1 && Store.luckysheet_copy_save["copyRange"] != null && Store.luckysheet_copy_save["copyRange"].length > 0 && isEqual) {
//剪切板内容 和 luckysheet本身复制的内容 一致 //剪切板内容 和 luckysheet本身复制的内容 一致
if (Store.luckysheet_paste_iscut) { if (Store.luckysheet_paste_iscut) {

2
src/css/luckysheet-core.css

@ -122,7 +122,7 @@
.luckysheet_info_detail_save { .luckysheet_info_detail_save {
color: #828282; color: #828282;
font-size: 12px; font-size: 12px;
margin-left: 5px; margin:0 5px;
} }
.luckysheet-share-logo { .luckysheet-share-logo {

3
src/global/method.js

@ -491,6 +491,9 @@ const method = {
dataVerificationCtrl[key] = defaultDataVerification[key]; dataVerificationCtrl[key] = defaultDataVerification[key];
} }
} }
// remove proxy
Store.asyncLoad = ['core'];
}, },
editorChart:function(c){ editorChart:function(c){
let chart_selection_color = luckyColor[0]; let chart_selection_color = luckyColor[0];

6
src/index.html

@ -71,7 +71,7 @@
loadUrl: location.origin + "/luckysheet/api/load", loadUrl: location.origin + "/luckysheet/api/load",
loadSheetUrl: location.origin + "/luckysheet/api/loadsheet" loadSheetUrl: location.origin + "/luckysheet/api/loadsheet"
} }
}else{ }else{
// http://localhost:3000/ // http://localhost:3000/
options = { options = {
container: 'luckysheet', container: 'luckysheet',
@ -165,6 +165,10 @@
workbookCreateAfter:function(json){ workbookCreateAfter:function(json){
// console.info(json) // console.info(json)
}, },
rangePasteBefore:function(range,data){
// console.info('rangePasteBefore',range,data)
// return false; //Can intercept paste
},
}, },

Loading…
Cancel
Save