Add Mono button to SCEditor
This commit is contained in:
parent
bb0737e384
commit
5cf3202b41
4 changed files with 36 additions and 3 deletions
|
@ -237,6 +237,9 @@
|
|||
},
|
||||
ltr: {
|
||||
txtExec: ['[ltr]', '[/ltr]']
|
||||
},
|
||||
mono: {
|
||||
txtExec: ['[mono]', '[/mono]']
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
'underline': '<text x="50%" y="50%" text-anchor="middle" dy=".5ex" font-family="Dejavu Sans, Helvetica, Arial, sans-serif" font-weight="bold" font-size="15" text-decoration="underline">U</text>',
|
||||
'undo': '<path d="M2 7h5L2 2z"/><path d="M6.447 2.205c-1 .268-1.932.796-2.69 1.553l-.706.707 1.414 1.414.707-.707a3.995 3.995 0 0 1 3.863-1.035 3.995 3.995 0 0 1 2.828 2.828 3.995 3.995 0 0 1-1.035 3.863l-.707.707 1.414 1.414.707-.707a6.003 6.003 0 0 0 1.553-5.795 6.003 6.003 0 0 0-7.348-4.242z"/>',
|
||||
'unlink': '<path d="M2 4c-.625 0-1.009.438-1.188.75s-.269.63-.344.969c-.15.677-.219 1.476-.219 2.28s.068 1.605.219 2.282c.075.339.165.625.344.938s.563.78 1.188.78h4v-2H2.469c-.022-.065-.042-.06-.063-.155-.1-.447-.156-1.15-.156-1.844s.057-1.396.156-1.844c.02-.088.042-.092.063-.156H6V4H2zm8 0v2h3.531c.021.064.043.068.063.156.1.448.156 1.149.156 1.844s-.057 1.396-.156 1.844c-.021.095-.041.09-.063.156H10v2h4c.625 0 1.009-.47 1.188-.781s.269-.6.344-.938c.15-.678.219-1.476.219-2.281s-.068-1.604-.219-2.281c-.075-.34-.165-.656-.344-.97S14.625 4 14 4h-4z"/>',
|
||||
'youtube': '<path d="M2 2C1 2 0 3 0 4v8c0 1 1 2 2 2h12c1 0 2-1 2-2V4c0-1-1-2-2-2H2zm4 3l6 3-6 3V5z"/>'
|
||||
'youtube': '<path d="M2 2C1 2 0 3 0 4v8c0 1 1 2 2 2h12c1 0 2-1 2-2V4c0-1-1-2-2-2H2zm4 3l6 3-6 3V5z"/>',
|
||||
'mono' : '<path d="M6 2v1.333H4v9.333h2v1.333H2.667V2H6zm4 0h3.333v12H10v-1.333h2V3.333h-2V2z"/>'
|
||||
};
|
||||
|
||||
sceditor.icons.monocons = function () {
|
||||
|
|
|
@ -1319,7 +1319,7 @@
|
|||
toolbar: 'bold,italic,underline,strike,subscript,superscript|' +
|
||||
'left,center,right,justify|font,size,color,removeformat|' +
|
||||
'cut,copy,pastetext|bulletlist,orderedlist,indent,outdent|' +
|
||||
'table|code,quote|horizontalrule,image,email,link,unlink|' +
|
||||
'table|code,mono,quote|horizontalrule,image,email,link,unlink|' +
|
||||
'emoticon,youtube,date,time|ltr,rtl|print,maximize,source',
|
||||
|
||||
/**
|
||||
|
@ -2866,6 +2866,35 @@
|
|||
},
|
||||
// END_COMMAND
|
||||
|
||||
// START_COMMAND: Centre
|
||||
mono: {
|
||||
state: function (parents) {
|
||||
return !!closest(parents, 'span.f-bb-mono');
|
||||
},
|
||||
exec: function () {
|
||||
var editor = this,
|
||||
rangeHelper = editor.getRangeHelper(),
|
||||
mono = closest(rangeHelper.parentNode(), 'span.f-bb-mono'),
|
||||
range = rangeHelper.selectedRange();
|
||||
|
||||
editor.focus();
|
||||
|
||||
if (mono) {
|
||||
if (mono.nextSibling) {
|
||||
range.setStartBefore(mono.nextSibling);
|
||||
range.setEndBefore(mono.nextSibling);
|
||||
}
|
||||
} else {
|
||||
this.wysiwygEditorInsertHtml(
|
||||
'<span class="f-bb-mono">',
|
||||
'</span>'
|
||||
);
|
||||
}
|
||||
},
|
||||
tooltip: 'Mono'
|
||||
},
|
||||
// END_COMMAND
|
||||
|
||||
// this is here so that commands above can be removed
|
||||
// without having to remove the , after the last one.
|
||||
// Needed for IE.
|
||||
|
|
|
@ -31,7 +31,7 @@ ForkBB.editor = (function (doc, win) {
|
|||
toolbar: 'bold,italic,underline,strike,subscript,superscript|' +
|
||||
'left,center,right,justify|font,size,color,removeformat|' +
|
||||
'bulletlist,orderedlist,indent,outdent|' +
|
||||
'table|code,quote|horizontalrule,image,email,link,unlink|' +
|
||||
'table|code,mono,quote|horizontalrule,image,email,link,unlink|' +
|
||||
'emoticon,date,time|maximize,source'
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue