[Pkg-mozext-commits] [itsalltext] 154/459: * updated changelog & version number. * gumdrop and menu isn't shown when textarea is readonly/disabled. * context menu is available in more places.
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit 847ce055bab33e9c822263bf0df28c8ce132c951
Author: docwhat at gerf.org <docwhat at gerf.org>
Date: Thu Mar 1 13:06:10 2007 -0500
* updated changelog & version number.
* gumdrop and menu isn't shown when textarea is readonly/disabled.
* context menu is available in more places.
---
changelog.txt | 5 +++++
chrome/content/cacheobj.js | 5 ++++-
chrome/content/itsalltext.js | 36 ++++++++++++++++++++----------------
install.rdf | 2 +-
4 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/changelog.txt b/changelog.txt
index 55d7710..09e4401 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -10,6 +10,11 @@ Note to Mac OS X users: Most editors come with a component in
strange, then create a shell script to do an "open -a /path/to/editor
$*".
+****** 0.4.3 ******
+* fixed gumdrop positioning
+* Hide gumdrop/menu when textarea is readonly/disabled.
+* Show context menu all the time
+
****** 0.4.2 ******
* Stupid bugs fixed.
* The popup positions right in XP.
diff --git a/chrome/content/cacheobj.js b/chrome/content/cacheobj.js
index 8f6f249..0d37c61 100644
--- a/chrome/content/cacheobj.js
+++ b/chrome/content/cacheobj.js
@@ -445,7 +445,10 @@ CacheObj.prototype.adjust = function() {
var style = gumdrop.style;
if (!gumdrop || !el) { return; }
var display = '';
- if (el.style.display == 'none') {
+ if (el.style.display == 'none' ||
+ el.getAttribute('readonly') ||
+ el.getAttribute('disabled')
+ ) {
display = 'none';
}
if (style.display != display) {
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index 8c2311c..8537501 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -442,6 +442,7 @@ var ItsAllText = function() {
* @param {Object} node A DOM element.
* @return {Array} The X & Y page offsets
*/
+ // @todo: [9] Remove getPageOffset if it's not used
that.getPageOffset = function(node) {
var pos = [node.offsetLeft, node.offsetTop];
var pnode = node.offsetParent;
@@ -573,21 +574,20 @@ var ItsAllText = function() {
* @param {Object} event The event passed in by the event handler.
*/
that.onContextMenu = function(event) {
- if(event.target && event.target.id) {
- var id = event.target.id;
+ if(event.target &&
+ event.target.id == "itsalltext-context-popup") {
var node = document.popupNode;
var cobj = that.getCacheObj(node);
var tag = node.nodeName.toLowerCase();
- if(id == "contentAreaContextMenu") {
- var menu = document.getElementById("itsalltext-contextmenu");
- menu.setAttribute('hidden', (tag != "textarea" &&
- tag != "textbox"));
- }
- if(id == "itsalltext-context-popup" &&
- (tag == 'textarea' || tag == 'textbox')) {
- that.rebuildMenu(cobj.uid,
- 'itsalltext-context-popup');
- }
+ var is_disabled = (!(tag == 'textarea' ||
+ tag == 'textbox') ||
+ node.style.display == 'none' ||
+ node.getAttribute('readonly') ||
+ node.getAttribute('disabled')
+ );
+ that.rebuildMenu(cobj.uid,
+ 'itsalltext-context-popup',
+ is_disabled);
}
return true;
};
@@ -666,13 +666,15 @@ ItsAllText.prototype.menuExtEdit = function(event) {
* @private
* @param {String} uid The UID to show in the option menu.
*/
-ItsAllText.prototype.rebuildMenu = function(uid, menu_id) {
+ItsAllText.prototype.rebuildMenu = function(uid, menu_id, is_disabled) {
menu_id = typeof(menu_id) == 'string'?menu_id:'itsalltext-optionmenu';
+ is_disabled = (typeof(is_disabled) == 'undefined'||!is_disabled)?false:(is_disabled&&true);
var i;
var that = this;
var exts = that.getExtensions();
var menu = document.getElementById(menu_id);
var items = menu.childNodes;
+ var items_length = items.length - 1; /* We ignore the preferences item */
var node;
that._current_uid = uid;
var magic_stop_node = null;
@@ -680,16 +682,17 @@ ItsAllText.prototype.rebuildMenu = function(uid, menu_id) {
var magic_stop = null;
// Find the beginning and end of the magic replacement parts.
- for(i=0; i<items.length; i++) {
+ for(i=0; i<items_length; i++) {
node = items[i];
if (node.nodeName.toLowerCase() == 'menuseparator') {
if(magic_start === null) {
magic_start = i;
- } else {
+ } else if (magic_stop === null) {
magic_stop = i;
magic_stop_node = node;
- break;
}
+ } else if (node.nodeName.toLowerCase() == 'menuitem') {
+ node.setAttribute('disabled', is_disabled?'true':'false');
}
}
@@ -703,6 +706,7 @@ ItsAllText.prototype.rebuildMenu = function(uid, menu_id) {
node = document.createElementNS(that.XULNS, 'menuitem');
node.setAttribute('label', exts[i]);
node.addEventListener('command', function(event){return that.menuExtEdit(event);}, false);
+ node.setAttribute('disabled', is_disabled?'true':'false');
menu.insertBefore(node, magic_stop_node);
}
diff --git a/install.rdf b/install.rdf
index 91dc3d7..a54ff2d 100644
--- a/install.rdf
+++ b/install.rdf
@@ -12,7 +12,7 @@
em:maxVersion="0.8" />
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="itsalltext at docwhat.gerf.org"
- em:version="0.4.2"
+ em:version="0.4.3"
em:type="2"
em:name="It's All Text!"
em:description="Edit text using your favorite editor!"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list