Skip to content

Commit 07eda5a

Browse files
SimeonCSimeonC
SimeonC
authored and
SimeonC
committed
feat(ta-hidden-input): Add new class for hidden inputs
1 parent a08bdc5 commit 07eda5a

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

lib/globals.js

+4-17
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ if(_browserDetect.webkit) {
5757
globalContentEditableBlur = false;
5858
}, false); // add global click handler
5959
angular.element(document).ready(function () {
60-
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">'));
60+
angular.element(document.body).append(angular.element('<input id="textAngular-editableFix-010203040506070809" class="ta-hidden-input" unselectable="on" tabIndex="-1">'));
6161
});
6262
}
6363

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

66-
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;
67-
var LISTELEMENTS = /^(ul|li|ol)$/ig;
68-
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;
66+
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;
67+
var LISTELEMENTS = /^(ul|li|ol)$/i;
68+
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;
6969

7070
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Compatibility
7171
/* istanbul ignore next: trim shim for older browsers */
@@ -153,17 +153,4 @@ if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
153153
sheet.deleteRule(index);
154154
}
155155
};
156-
}
157-
158-
// recursive function that returns an array of angular.elements that have the passed attribute set on them
159-
function getByAttribute(element, attribute){
160-
var resultingElements = [];
161-
var childNodes = element.children();
162-
if(childNodes.length){
163-
angular.forEach(childNodes, function(child){
164-
resultingElements = resultingElements.concat(getByAttribute(angular.element(child), attribute));
165-
});
166-
}
167-
if(element.attr(attribute) !== undefined) resultingElements.push(element);
168-
return resultingElements;
169156
}

src/textAngular.css

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ Version 1.3.0
77
See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
88
*/
99

10+
.ta-hidden-input {
11+
width: 1px;
12+
height: 1px;
13+
border: none;
14+
margin: 0;
15+
padding: 0;
16+
position: absolute;
17+
top: -10000px;
18+
left: -10000px;
19+
opacity: 0;
20+
overflow: hidden;
21+
}
22+
1023
/* add generic styling for the editor */
1124
.ta-root.focussed > .ta-scroll-window.form-control {
1225
border-color: #66afe9;

0 commit comments

Comments
 (0)