Skip to content

Commit

Permalink
feat(ta-hidden-input): Add new class for hidden inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonC authored and SimeonC committed Feb 5, 2015
1 parent a08bdc5 commit 07eda5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
21 changes: 4 additions & 17 deletions lib/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ if(_browserDetect.webkit) {
globalContentEditableBlur = false;
}, false); // add global click handler
angular.element(document).ready(function () {
angular.element(document.body).append(angular.element('<input id="textAngular-editableFix-010203040506070809" style="width:1px;height:1px;border:none;margin:0;padding:0;position:absolute; top: -10000px; left: -10000px;" unselectable="on" tabIndex="-1">'));
angular.element(document.body).append(angular.element('<input id="textAngular-editableFix-010203040506070809" class="ta-hidden-input" unselectable="on" tabIndex="-1">'));
});
}

// Gloabl to textAngular REGEXP vars for block and list elements.

var BLOCKELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/ig;
var LISTELEMENTS = /^(ul|li|ol)$/ig;
var VALIDELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/ig;
var BLOCKELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i;
var LISTELEMENTS = /^(ul|li|ol)$/i;
var VALIDELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Compatibility
/* istanbul ignore next: trim shim for older browsers */
Expand Down Expand Up @@ -153,17 +153,4 @@ if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
sheet.deleteRule(index);
}
};
}

// recursive function that returns an array of angular.elements that have the passed attribute set on them
function getByAttribute(element, attribute){
var resultingElements = [];
var childNodes = element.children();
if(childNodes.length){
angular.forEach(childNodes, function(child){
resultingElements = resultingElements.concat(getByAttribute(angular.element(child), attribute));
});
}
if(element.attr(attribute) !== undefined) resultingElements.push(element);
return resultingElements;
}
13 changes: 13 additions & 0 deletions src/textAngular.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ Version 1.3.0
See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
*/

.ta-hidden-input {
width: 1px;
height: 1px;
border: none;
margin: 0;
padding: 0;
position: absolute;
top: -10000px;
left: -10000px;
opacity: 0;
overflow: hidden;
}

/* add generic styling for the editor */
.ta-root.focussed > .ta-scroll-window.form-control {
border-color: #66afe9;
Expand Down

0 comments on commit 07eda5a

Please sign in to comment.