Skip to content

Commit

Permalink
Update beta version
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Pulges committed Dec 17, 2014
1 parent 23c2415 commit d7b1126
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 82 deletions.
18 changes: 14 additions & 4 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
*wysihtml5x 0.5.0-beta3* (December 17, 2014)
* Fixes IE9 error if classList polyfill present allready
* Fix #78 Preserve cursor position on editor.cleanUp()
* Fix table cells selection is broken

*wysihtml5x 0.5.0-beta2* (December 11, 2014)
* Fix tab key triggering error
* Update repo naming


*wysihtml5x 0.5.0-beta1* (December 4, 2014)
* formatBlock update
* Selections apply format to selection not its parent block,
* Removed toggle functionality from many formatBlock commands (h1-6, p, pre ...) and added plaintext state to formatblock instead.
* Code modernization
* Changes API!
* Selections apply format to selection not its parent block,
* Removed toggle functionality from many formatBlock commands (h1-6, p, pre ...) and added plaintext state to formatblock instead.
* Code modernization
* Changes API!
* Allow tel: scheme in links
* Fixed atributeless A tags
* Added "dimension" to checkattributes methods (for with/height attributes where floating point numbrs and percentages are allowed)
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wysihtml",
"version": "0.5.0-beta2",
"version": "0.5.0-beta3",
"main": [
"dist/wysihtml.min.js",
"dist/wysihtml-toolbar.min.js"
Expand Down
70 changes: 39 additions & 31 deletions dist/wysihtml-toolbar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// TODO: in future try to replace most inline compability checks with polyfills for code readability

// IE8 SUPPORT BLOCK
// You can compile wuthout all this if IE8 is not needed
// You can compile without all this if IE8 is not needed

// String trim for ie8
if (!String.prototype.trim) {
Expand Down Expand Up @@ -321,9 +321,10 @@ if ("document" in self) {

}(self));

} else {
} else if ("DOMTokenList" in window) {
// There is full or partial native classList support, so just check if we need
// to normalize the add/remove and toggle APIs.
// DOMTokenList is expected to exist (removes conflicts with multiple polyfills present on site)

(function() {
"use strict";
Expand Down Expand Up @@ -376,7 +377,7 @@ if ("document" in self) {
}

;/**
* @license wysihtml5x v0.5.0-beta2
* @license wysihtml5x v0.5.0-beta3
* https://github.com/Edicy/wysihtml5
*
* Author: Christopher Blum (https://github.com/tiff)
Expand All @@ -387,7 +388,7 @@ if ("document" in self) {
*
*/
var wysihtml5 = {
version: "0.5.0-beta2",
version: "0.5.0-beta3",

// namespaces
commands: {},
Expand Down Expand Up @@ -9001,22 +9002,20 @@ wysihtml5.quirks.ensureProperClearing = (function() {
cells: null,
select: selectCells
},
selection_class = "wysiwyg-tmp-selected-cell",
moveHandler = null,
upHandler = null;
selection_class = "wysiwyg-tmp-selected-cell";

function init () {

dom.observe(editable, "mousedown", function(event) {
var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
if (target) {
handleSelectionMousedown(target);
}
});

editable.addEventListener("mousedown", handleMouseDown);
return select;
}

var handleMouseDown = function(event) {
var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
if (target) {
handleSelectionMousedown(target);
}
};

function handleSelectionMousedown (target) {
select.start = target;
select.end = target;
Expand All @@ -9026,8 +9025,8 @@ wysihtml5.quirks.ensureProperClearing = (function() {
if (select.table) {
removeCellSelections();
dom.addClass(target, selection_class);
moveHandler = dom.observe(editable, "mousemove", handleMouseMove);
upHandler = dom.observe(editable, "mouseup", handleMouseUp);
editable.addEventListener("mousemove", handleMouseMove);
editable.addEventListener("mouseup", handleMouseUp);
editor.fire("tableselectstart").fire("tableselectstart:composer");
}
}
Expand All @@ -9052,7 +9051,7 @@ wysihtml5.quirks.ensureProperClearing = (function() {

function handleMouseMove (event) {
var curTable = null,
cell = dom.getParentElement(event.target, { nodeName: "td, th" }),
cell = dom.getParentElement(event.target, { query: "td, th" }),
oldEnd;

if (cell && select.table && select.start) {
Expand All @@ -9074,25 +9073,27 @@ wysihtml5.quirks.ensureProperClearing = (function() {
}

function handleMouseUp (event) {
moveHandler.stop();
upHandler.stop();
editable.removeEventListener("mousemove", handleMouseMove);
editable.removeEventListener("mouseup", handleMouseUp);
editor.fire("tableselect").fire("tableselect:composer");
setTimeout(function() {
bindSideclick();
},0);
}

var sideClickHandler = function(event) {
editable.ownerDocument.removeEventListener("click", sideClickHandler);
if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
removeCellSelections();
select.table = null;
select.start = null;
select.end = null;
editor.fire("tableunselect").fire("tableunselect:composer");
}
};

function bindSideclick () {
var sideClickHandler = dom.observe(editable.ownerDocument, "click", function(event) {
sideClickHandler.stop();
if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
removeCellSelections();
select.table = null;
select.start = null;
select.end = null;
editor.fire("tableunselect").fire("tableunselect:composer");
}
});
editable.ownerDocument.addEventListener("click", sideClickHandler);
}

function selectCells (start, end) {
Expand Down Expand Up @@ -12965,7 +12966,14 @@ wysihtml5.views.View = Base.extend(
},

cleanUp: function() {
this.parent.parse(this.element);
var bookmark;
if (this.selection) {
bookmark = rangy.saveSelection(this.doc.defaultView || this.doc.parentWindow);
}
this.parent.parse(this.element);
if (bookmark) {
rangy.restoreSelection(bookmark);
}
},

show: function() {
Expand Down
12 changes: 6 additions & 6 deletions dist/wysihtml-toolbar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/wysihtml-toolbar.min.map

Large diffs are not rendered by default.

70 changes: 39 additions & 31 deletions dist/wysihtml.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// TODO: in future try to replace most inline compability checks with polyfills for code readability

// IE8 SUPPORT BLOCK
// You can compile wuthout all this if IE8 is not needed
// You can compile without all this if IE8 is not needed

// String trim for ie8
if (!String.prototype.trim) {
Expand Down Expand Up @@ -321,9 +321,10 @@ if ("document" in self) {

}(self));

} else {
} else if ("DOMTokenList" in window) {
// There is full or partial native classList support, so just check if we need
// to normalize the add/remove and toggle APIs.
// DOMTokenList is expected to exist (removes conflicts with multiple polyfills present on site)

(function() {
"use strict";
Expand Down Expand Up @@ -376,7 +377,7 @@ if ("document" in self) {
}

;/**
* @license wysihtml5x v0.5.0-beta2
* @license wysihtml5x v0.5.0-beta3
* https://github.com/Edicy/wysihtml5
*
* Author: Christopher Blum (https://github.com/tiff)
Expand All @@ -387,7 +388,7 @@ if ("document" in self) {
*
*/
var wysihtml5 = {
version: "0.5.0-beta2",
version: "0.5.0-beta3",

// namespaces
commands: {},
Expand Down Expand Up @@ -9001,22 +9002,20 @@ wysihtml5.quirks.ensureProperClearing = (function() {
cells: null,
select: selectCells
},
selection_class = "wysiwyg-tmp-selected-cell",
moveHandler = null,
upHandler = null;
selection_class = "wysiwyg-tmp-selected-cell";

function init () {

dom.observe(editable, "mousedown", function(event) {
var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
if (target) {
handleSelectionMousedown(target);
}
});

editable.addEventListener("mousedown", handleMouseDown);
return select;
}

var handleMouseDown = function(event) {
var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
if (target) {
handleSelectionMousedown(target);
}
};

function handleSelectionMousedown (target) {
select.start = target;
select.end = target;
Expand All @@ -9026,8 +9025,8 @@ wysihtml5.quirks.ensureProperClearing = (function() {
if (select.table) {
removeCellSelections();
dom.addClass(target, selection_class);
moveHandler = dom.observe(editable, "mousemove", handleMouseMove);
upHandler = dom.observe(editable, "mouseup", handleMouseUp);
editable.addEventListener("mousemove", handleMouseMove);
editable.addEventListener("mouseup", handleMouseUp);
editor.fire("tableselectstart").fire("tableselectstart:composer");
}
}
Expand All @@ -9052,7 +9051,7 @@ wysihtml5.quirks.ensureProperClearing = (function() {

function handleMouseMove (event) {
var curTable = null,
cell = dom.getParentElement(event.target, { nodeName: "td, th" }),
cell = dom.getParentElement(event.target, { query: "td, th" }),
oldEnd;

if (cell && select.table && select.start) {
Expand All @@ -9074,25 +9073,27 @@ wysihtml5.quirks.ensureProperClearing = (function() {
}

function handleMouseUp (event) {
moveHandler.stop();
upHandler.stop();
editable.removeEventListener("mousemove", handleMouseMove);
editable.removeEventListener("mouseup", handleMouseUp);
editor.fire("tableselect").fire("tableselect:composer");
setTimeout(function() {
bindSideclick();
},0);
}

var sideClickHandler = function(event) {
editable.ownerDocument.removeEventListener("click", sideClickHandler);
if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
removeCellSelections();
select.table = null;
select.start = null;
select.end = null;
editor.fire("tableunselect").fire("tableunselect:composer");
}
};

function bindSideclick () {
var sideClickHandler = dom.observe(editable.ownerDocument, "click", function(event) {
sideClickHandler.stop();
if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
removeCellSelections();
select.table = null;
select.start = null;
select.end = null;
editor.fire("tableunselect").fire("tableunselect:composer");
}
});
editable.ownerDocument.addEventListener("click", sideClickHandler);
}

function selectCells (start, end) {
Expand Down Expand Up @@ -12965,7 +12966,14 @@ wysihtml5.views.View = Base.extend(
},

cleanUp: function() {
this.parent.parse(this.element);
var bookmark;
if (this.selection) {
bookmark = rangy.saveSelection(this.doc.defaultView || this.doc.parentWindow);
}
this.parent.parse(this.element);
if (bookmark) {
rangy.restoreSelection(bookmark);
}
},

show: function() {
Expand Down
10 changes: 5 additions & 5 deletions dist/wysihtml.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/wysihtml.min.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wysihtml",
"version": "0.5.0-beta2",
"version": "0.5.0-beta3",
"devDependencies": {
"grunt": "~0.4.4",
"grunt-contrib-concat": "~0.4.0",
Expand All @@ -14,7 +14,7 @@
"dependencies": {
"rangy": "^1.3.0-alpha.20140921"
},
"description": "h1. wysihtml 0.5.0-beata1",
"description": "h1. wysihtml 0.5.0-beata3",
"main": "Gruntfile.js",
"directories": {
"example": "examples",
Expand Down

0 comments on commit d7b1126

Please sign in to comment.