Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List configurable options #591

Closed
wants to merge 33 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e9d82d7
Default options for my own needs
4project-co-il Nov 24, 2017
38a81b2
Workaround to accept font sizes in percentage values,
4project-co-il Nov 24, 2017
6fed9a1
Remove a space addition to innerHTML in _createMarker function,
4project-co-il Nov 24, 2017
984789f
Move youtube parameters to configurable options, so everybody could
4project-co-il Nov 24, 2017
fa5f6be
Revert "Remove a space addition to innerHTML in _createMarker function,"
4project-co-il Nov 24, 2017
ab0292f
Revert "Default options for my own needs"
4project-co-il Nov 24, 2017
607ccbe
Revert "Workaround to accept font sizes in percentage values,"
4project-co-il Nov 24, 2017
99479f8
Pass global options to the parser
4project-co-il Nov 24, 2017
64c7ad5
YouTube template
4project-co-il Nov 24, 2017
f40ce3d
Editor options to formatter.
4project-co-il Nov 25, 2017
8924a10
Passing templates to formatter.
4project-co-il Nov 25, 2017
e5288c8
YouTube start time processing
4project-co-il Nov 25, 2017
6930725
Merge branch 'master' of https://github.com/samclarke/SCEditor
4project-co-il Nov 25, 2017
d2e4f36
Updating xhtml formatter
4project-co-il Nov 26, 2017
bb6e2b6
Drop downs for bullets and numbered lists.
4project-co-il Nov 26, 2017
4378d5d
bbcode UL parsing
4project-co-il Nov 27, 2017
9c6140d
xhtml UL changes
4project-co-il Nov 27, 2017
9c126f2
Adding UL type "none"
4project-co-il Nov 27, 2017
87813e6
bbcode OL parsing
4project-co-il Nov 27, 2017
02e4911
xhtml OL changes
4project-co-il Nov 27, 2017
36e6ec2
OL type changed to style="list-style-type:xxx"
4project-co-il Nov 27, 2017
9b79661
OL type changed to style="list-style-type:xxx"
4project-co-il Nov 27, 2017
13c5bfb
Merge branch 'list-enhancements' of https://github.com/abetis/SCEdito…
4project-co-il Nov 27, 2017
7e2754e
Typo fix
4project-co-il Nov 27, 2017
e2588c3
Fix UL dropdown styling, it didn't show well in RTL mode.
4project-co-il Nov 27, 2017
692a4c7
Merge branch 'youtube-tag-enhancements'
4project-co-il Nov 29, 2017
23675c1
Merge branch 'video-size-options'
4project-co-il Nov 29, 2017
41c8bd9
Merge fixes
4project-co-il Nov 29, 2017
8d77509
Merge branch 'list-enhancements'
4project-co-il Nov 29, 2017
605cdbd
Configurable UL options.
4project-co-il Nov 30, 2017
749b405
Configurable OL options.
4project-co-il Nov 30, 2017
30e16fa
Configurable OL options.
4project-co-il Nov 30, 2017
29e6181
Merge branch 'list-configurable-options' of https://github.com/abetis…
4project-co-il Nov 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Workaround to accept font sizes in percentage values,"
This reverts commit 38a81b2.
4project-co-il committed Nov 24, 2017
commit 607ccbe8a2fe9545b4a1f9084366d4971d2d450c
32 changes: 28 additions & 4 deletions src/formats/bbcode.js
Original file line number Diff line number Diff line change
@@ -369,15 +369,39 @@
size = 2;

if (!fontSize) {
fontSize = element.style['font-size'];
fontSize = css(element, 'fontSize');
}

// remove "%" from the option
size = fontSize.replace('%', '');
// Most browsers return px value but IE returns 1-7
if (fontSize.indexOf('px') > -1) {
// convert size to an int
fontSize = fontSize.replace('px', '') - 0;

if (fontSize < 12) {
size = 1;
}
if (fontSize > 15) {
size = 3;
}
if (fontSize > 17) {
size = 4;
}
if (fontSize > 23) {
size = 5;
}
if (fontSize > 31) {
size = 6;
}
if (fontSize > 47) {
size = 7;
}
} else {
size = fontSize;
}

return '[size=' + size + ']' + content + '[/size]';
},
html: '<font style="font-size:{defaultattr}%">{!0}</font>'
html: '<font size="{defaultattr}">{!0}</font>'
},
// END_COMMAND

19 changes: 1 addition & 18 deletions src/lib/SCEditor.js
Original file line number Diff line number Diff line change
@@ -2228,24 +2228,7 @@ export default function SCEditor(original, userOptions) {
}

try {
if (command === 'fontsize') {
// execCommand for fontsize accepts only numbers from 1 to 7,
// and it was deprecated!
// We'll set it to 3 and go over all the font tags with size 3
// and change it to use the style with specified

executed = wysiwygDocument.execCommand(command, false, 3);

var fontElements = wysiwygDocument.getElementsByTagName('font');
for (var i = 0, len = fontElements.length; i < len; ++i) {
if (fontElements[i].size === '3') {
fontElements[i].removeAttribute('size');
fontElements[i].style.fontSize = param + '%';
}
}
} else {
executed = wysiwygDocument.execCommand(command, false, param);
}
executed = wysiwygDocument.execCommand(command, false, param);
} catch (ex) { }

// show error if execution failed and an error message exists
10 changes: 5 additions & 5 deletions src/lib/defaultCommands.js
Original file line number Diff line number Diff line change
@@ -159,11 +159,11 @@ var defaultCmds = {
e.preventDefault();
});

dom.appendChild(content, _tmpl('sizeOpt', { size: 50}, true));
dom.appendChild(content, _tmpl('sizeOpt', { size: 75}, true));
dom.appendChild(content, _tmpl('sizeOpt', { size: 100}, true));
dom.appendChild(content, _tmpl('sizeOpt', { size: 150}, true));
dom.appendChild(content, _tmpl('sizeOpt', { size: 200}, true));
for (var i = 1; i <= 7; i++) {
dom.appendChild(content, _tmpl('sizeOpt', {
size: i
}, true));
}

editor.createDropDown(caller, 'fontsize-picker', content);
},
2 changes: 1 addition & 1 deletion src/lib/templates.js
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ var _templates = {
'data-font="{font}"><font face="{font}">{font}</font></a>',

sizeOpt: '<a class="sceditor-fontsize-option" data-size="{size}" ' +
'href="#"><font style="font-size={size}%">{size}%</font></a>',
'href="#"><font size="{size}">{size}</font></a>',

pastetext:
'<div><label for="txt">{label}</label> ' +