guy 7 years ago
parent
commit
a680f8cddb
  1. 69
      bi/base.js
  2. 69
      dist/base.js
  3. 69
      dist/bundle.js
  4. 2
      dist/bundle.min.css
  5. 56
      dist/bundle.min.js
  6. 7
      src/base/richeditor/bar/button.richeditor.js
  7. 1
      src/base/richeditor/bar/texttoolbar.js
  8. 6
      src/base/richeditor/niceditor/niceditor.js
  9. 56
      src/base/richeditor/plugins/button.param.js

69
bi/base.js

@ -16106,14 +16106,14 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
_init: function () {
BI.RichEditorAction.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, target) {
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, e) {
self.setEnable(true);
self.checkNodes(target);
self.checkNodes(e.target);
self.key(e)
});
o.editor.on(BI.NicEditor.EVENT_BLUR, function () {
self.setEnable(false);
});
o.editor.on(BI.NicEditor.EVENT_KEY, BI.bind(this.key, this));
},
checkNodes: function (e) {
@ -16157,7 +16157,6 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
if (this.options.command) {
this.options.editor.nicCommand(this.options.command, args);
}
this.options.editor.fireEvent("buttonClick", this);
}
});/**
* 颜色选择
@ -16180,6 +16179,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"},
],
height: 28
});
@ -16428,12 +16428,12 @@ BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/**
var selInstance = this.ne.selectedInstance;
if (selInstance != this) {
if (selInstance) {
this.ne.fireEvent('blur', selInstance, t);
this.ne.fireEvent('blur', selInstance, e);
}
this.ne.selectedInstance = this;
this.ne.fireEvent('focus', selInstance, t);
this.ne.fireEvent('focus', selInstance, e);
}
this.ne.fireEvent('selected', selInstance, t);
this.ne.fireEvent('selected', selInstance, e);
this.isFocused = true;
this.elm.element.addClass(prefix + 'selected');
}
@ -16714,6 +16714,61 @@ BI.RichEditorItalicButton = BI.inherit(BI.RichEditorAction, {
},
});
BI.shortcut("bi.rich_editor_italic_button", BI.RichEditorItalicButton)/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorParamButton
* @extends BI.RichEditorAction
*/
BI.RichEditorParamButton = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () {
return BI.extend(BI.RichEditorParamButton.superclass._defaultConfig.apply(this, arguments), {
width: 20,
height: 20,
});
},
_init: function () {
BI.RichEditorParamButton.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.param = BI.createWidget({
type: "bi.button",
element: this,
level: "ignore",
minWidth: 0,
text: BI.i18nText("BI-Formula_Insert"),
height: 20,
width: 30
});
this.param.on(BI.Button.EVENT_CHANGE, function () {
var sel = $(o.editor.selectedInstance.selElm());
var param = "<span data-type='param' style='background-color: #009de3;color:white;padding:0 5px;'>参数</span>"
if (o.editor.instance.getElm().element.find(sel).length <= 0) {
o.editor.instance.getElm().element.append(param);
return;
}
var ln = sel.closest("a");
if (ln.length === 0) {
sel.after(param)
}
});
},
activate: function () {
},
deactivate: function () {
},
key: function (e) {
var o = this.options;
if (e.keyCode === BI.KeyCode.BACKSPACE) {
var sel = $(o.editor.selectedInstance.selElm()).parent();
if (sel.attr("data-type") === "param") {
sel.destroy();
}
}
}
});
BI.shortcut("bi.rich_editor_param_button", BI.RichEditorParamButton)/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorItalicButton

69
dist/base.js vendored

@ -16106,14 +16106,14 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
_init: function () {
BI.RichEditorAction.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, target) {
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, e) {
self.setEnable(true);
self.checkNodes(target);
self.checkNodes(e.target);
self.key(e)
});
o.editor.on(BI.NicEditor.EVENT_BLUR, function () {
self.setEnable(false);
});
o.editor.on(BI.NicEditor.EVENT_KEY, BI.bind(this.key, this));
},
checkNodes: function (e) {
@ -16157,7 +16157,6 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
if (this.options.command) {
this.options.editor.nicCommand(this.options.command, args);
}
this.options.editor.fireEvent("buttonClick", this);
}
});/**
* 颜色选择
@ -16180,6 +16179,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"},
],
height: 28
});
@ -16428,12 +16428,12 @@ BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/**
var selInstance = this.ne.selectedInstance;
if (selInstance != this) {
if (selInstance) {
this.ne.fireEvent('blur', selInstance, t);
this.ne.fireEvent('blur', selInstance, e);
}
this.ne.selectedInstance = this;
this.ne.fireEvent('focus', selInstance, t);
this.ne.fireEvent('focus', selInstance, e);
}
this.ne.fireEvent('selected', selInstance, t);
this.ne.fireEvent('selected', selInstance, e);
this.isFocused = true;
this.elm.element.addClass(prefix + 'selected');
}
@ -16714,6 +16714,61 @@ BI.RichEditorItalicButton = BI.inherit(BI.RichEditorAction, {
},
});
BI.shortcut("bi.rich_editor_italic_button", BI.RichEditorItalicButton)/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorParamButton
* @extends BI.RichEditorAction
*/
BI.RichEditorParamButton = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () {
return BI.extend(BI.RichEditorParamButton.superclass._defaultConfig.apply(this, arguments), {
width: 20,
height: 20,
});
},
_init: function () {
BI.RichEditorParamButton.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.param = BI.createWidget({
type: "bi.button",
element: this,
level: "ignore",
minWidth: 0,
text: BI.i18nText("BI-Formula_Insert"),
height: 20,
width: 30
});
this.param.on(BI.Button.EVENT_CHANGE, function () {
var sel = $(o.editor.selectedInstance.selElm());
var param = "<span data-type='param' style='background-color: #009de3;color:white;padding:0 5px;'>参数</span>"
if (o.editor.instance.getElm().element.find(sel).length <= 0) {
o.editor.instance.getElm().element.append(param);
return;
}
var ln = sel.closest("a");
if (ln.length === 0) {
sel.after(param)
}
});
},
activate: function () {
},
deactivate: function () {
},
key: function (e) {
var o = this.options;
if (e.keyCode === BI.KeyCode.BACKSPACE) {
var sel = $(o.editor.selectedInstance.selElm()).parent();
if (sel.attr("data-type") === "param") {
sel.destroy();
}
}
}
});
BI.shortcut("bi.rich_editor_param_button", BI.RichEditorParamButton)/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorItalicButton

69
dist/bundle.js vendored

@ -44912,14 +44912,14 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
_init: function () {
BI.RichEditorAction.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, target) {
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, e) {
self.setEnable(true);
self.checkNodes(target);
self.checkNodes(e.target);
self.key(e)
});
o.editor.on(BI.NicEditor.EVENT_BLUR, function () {
self.setEnable(false);
});
o.editor.on(BI.NicEditor.EVENT_KEY, BI.bind(this.key, this));
},
checkNodes: function (e) {
@ -44963,7 +44963,6 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
if (this.options.command) {
this.options.editor.nicCommand(this.options.command, args);
}
this.options.editor.fireEvent("buttonClick", this);
}
});/**
* 颜色选择
@ -44986,6 +44985,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"},
],
height: 28
});
@ -45234,12 +45234,12 @@ BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/**
var selInstance = this.ne.selectedInstance;
if (selInstance != this) {
if (selInstance) {
this.ne.fireEvent('blur', selInstance, t);
this.ne.fireEvent('blur', selInstance, e);
}
this.ne.selectedInstance = this;
this.ne.fireEvent('focus', selInstance, t);
this.ne.fireEvent('focus', selInstance, e);
}
this.ne.fireEvent('selected', selInstance, t);
this.ne.fireEvent('selected', selInstance, e);
this.isFocused = true;
this.elm.element.addClass(prefix + 'selected');
}
@ -45520,6 +45520,61 @@ BI.RichEditorItalicButton = BI.inherit(BI.RichEditorAction, {
},
});
BI.shortcut("bi.rich_editor_italic_button", BI.RichEditorItalicButton)/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorParamButton
* @extends BI.RichEditorAction
*/
BI.RichEditorParamButton = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () {
return BI.extend(BI.RichEditorParamButton.superclass._defaultConfig.apply(this, arguments), {
width: 20,
height: 20,
});
},
_init: function () {
BI.RichEditorParamButton.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.param = BI.createWidget({
type: "bi.button",
element: this,
level: "ignore",
minWidth: 0,
text: BI.i18nText("BI-Formula_Insert"),
height: 20,
width: 30
});
this.param.on(BI.Button.EVENT_CHANGE, function () {
var sel = $(o.editor.selectedInstance.selElm());
var param = "<span data-type='param' style='background-color: #009de3;color:white;padding:0 5px;'>参数</span>"
if (o.editor.instance.getElm().element.find(sel).length <= 0) {
o.editor.instance.getElm().element.append(param);
return;
}
var ln = sel.closest("a");
if (ln.length === 0) {
sel.after(param)
}
});
},
activate: function () {
},
deactivate: function () {
},
key: function (e) {
var o = this.options;
if (e.keyCode === BI.KeyCode.BACKSPACE) {
var sel = $(o.editor.selectedInstance.selElm()).parent();
if (sel.attr("data-type") === "param") {
sel.destroy();
}
}
}
});
BI.shortcut("bi.rich_editor_param_button", BI.RichEditorParamButton)/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorItalicButton

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

56
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

7
src/base/richeditor/bar/button.richeditor.js

@ -18,14 +18,14 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
_init: function () {
BI.RichEditorAction.superclass._init.apply(this, arguments);
var self = this, o = this.options;
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, target) {
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (ins, e) {
self.setEnable(true);
self.checkNodes(target);
self.checkNodes(e.target);
self.key(e)
});
o.editor.on(BI.NicEditor.EVENT_BLUR, function () {
self.setEnable(false);
});
o.editor.on(BI.NicEditor.EVENT_KEY, BI.bind(this.key, this));
},
checkNodes: function (e) {
@ -69,6 +69,5 @@ BI.RichEditorAction = BI.inherit(BI.Widget, {
if (this.options.command) {
this.options.editor.nicCommand(this.options.command, args);
}
this.options.editor.fireEvent("buttonClick", this);
}
});

1
src/base/richeditor/bar/texttoolbar.js

@ -19,6 +19,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, {
{type: "bi.rich_editor_align_left_button"},
{type: "bi.rich_editor_align_center_button"},
{type: "bi.rich_editor_align_right_button"},
{type: "bi.rich_editor_param_button"},
],
height: 28
});

6
src/base/richeditor/niceditor/niceditor.js

@ -206,12 +206,12 @@
var selInstance = this.ne.selectedInstance;
if (selInstance != this) {
if (selInstance) {
this.ne.fireEvent('blur', selInstance, t);
this.ne.fireEvent('blur', selInstance, e);
}
this.ne.selectedInstance = this;
this.ne.fireEvent('focus', selInstance, t);
this.ne.fireEvent('focus', selInstance, e);
}
this.ne.fireEvent('selected', selInstance, t);
this.ne.fireEvent('selected', selInstance, e);
this.isFocused = true;
this.elm.element.addClass(prefix + 'selected');
}

56
src/base/richeditor/plugins/button.param.js

@ -0,0 +1,56 @@
/**
*
* Created by GUY on 2015/11/26.
* @class BI.RichEditorParamButton
* @extends BI.RichEditorAction
*/
BI.RichEditorParamButton = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () {
return BI.extend(BI.RichEditorParamButton.superclass._defaultConfig.apply(this, arguments), {
width: 20,
height: 20,
});
},
_init: function () {
BI.RichEditorParamButton.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.param = BI.createWidget({
type: "bi.button",
element: this,
level: "ignore",
minWidth: 0,
text: BI.i18nText("BI-Formula_Insert"),
height: 20,
width: 30
});
this.param.on(BI.Button.EVENT_CHANGE, function () {
var sel = $(o.editor.selectedInstance.selElm());
var param = "<span data-type='param' style='background-color: #009de3;color:white;padding:0 5px;'>参数</span>"
if (o.editor.instance.getElm().element.find(sel).length <= 0) {
o.editor.instance.getElm().element.append(param);
return;
}
var ln = sel.closest("a");
if (ln.length === 0) {
sel.after(param)
}
});
},
activate: function () {
},
deactivate: function () {
},
key: function (e) {
var o = this.options;
if (e.keyCode === BI.KeyCode.BACKSPACE) {
var sel = $(o.editor.selectedInstance.selElm()).parent();
if (sel.attr("data-type") === "param") {
sel.destroy();
}
}
}
});
BI.shortcut("bi.rich_editor_param_button", BI.RichEditorParamButton)
Loading…
Cancel
Save