Skip to content

Commit

Permalink
Merge pull request #509 from mycolorway/biallo/fix-span-fontsize
Browse files Browse the repository at this point in the history
FIX: 在 Chrome 63.0.3239.84 中,粘贴内容的 font-size 可能为 1px 的问题
  • Loading branch information
biallo authored Dec 11, 2017
2 parents 0075596 + c01f373 commit b9ce87c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simditor",
"version": "2.3.7",
"version": "2.3.8",
"homepage": "http://simditor.tower.im/",
"authors": [
"farthinker <farthinker@gmail.com>"
Expand Down
9 changes: 6 additions & 3 deletions lib/simditor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Simditor v2.3.7
* Simditor v2.3.8
* http://simditor.tower.im/
* 2017-11-14
* 2017-12-11
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -710,7 +710,10 @@ Formatter = (function(superClass) {
style = ref[k];
style = $.trim(style);
pair = style.split(':');
if (!(pair.length = 2)) {
if (pair.length !== 2) {
continue;
}
if (pair[0] === 'font-size' && parseInt(pair[1], 10) < 12) {
continue;
}
if (ref1 = pair[0], indexOf.call(allowedStyles, ref1) >= 0) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simditor",
"version": "2.3.7",
"version": "2.3.8",
"description": "A simple online editor",
"keywords": "editor simditor",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion site/assets/scripts/simditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,10 @@ Formatter = (function(superClass) {
style = ref[k];
style = $.trim(style);
pair = style.split(':');
if (!(pair.length = 2)) {
if (pair.length !== 2) {
continue;
}
if (pair[0] === 'font-size' && parseInt(pair[1], 10) < 12) {
continue;
}
if (ref1 = pair[0], indexOf.call(allowedStyles, ref1) >= 0) {
Expand Down
5 changes: 4 additions & 1 deletion src/formatter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ class Formatter extends SimpleModule
for style in styleStr.split(';')
style = $.trim style
pair = style.split(':')
continue unless pair.length = 2

continue unless pair.length == 2
continue if pair[0] == 'font-size' and parseInt(pair[1], 10) < 12

styles[$.trim(pair[0])] = $.trim(pair[1]) if pair[0] in allowedStyles

$node.css styles if Object.keys(styles).length > 0
Expand Down
4 changes: 2 additions & 2 deletions styles/simditor.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Simditor v2.3.7
* Simditor v2.3.8
* http://simditor.tower.im/
* 2017-11-14
* 2017-12-11
*/
@font-face {
font-family: 'Simditor';
Expand Down

0 comments on commit b9ce87c

Please sign in to comment.