ep_context
Advanced tools
Comparing version 0.0.5 to 0.0.7
{ | ||
"description": "Context for Etherpad Documents, very WIP.", | ||
"name": "ep_context", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "John McLear", |
@@ -53,3 +53,2 @@ var _, $, jQuery; | ||
var documentAttributeManager = call.documentAttributeManager; | ||
if(!(cs.type == "handleClick") && !(cs.type == "handleKeyEvent") && !(cs.docTextChanged)){ | ||
@@ -65,6 +64,7 @@ return false; | ||
var thisLine = rep.selEnd[0]; | ||
// This should only fire on a new line, at the moment it fires on a new tab! | ||
var attributes = documentAttributeManager.getAttributeOnLine(lastLine, 'context'); | ||
if(attributes){ | ||
// The line did have attributes so set them on the new line | ||
// But before we apply a new attribute we should see if we're supposed to be dropping an context layer | ||
@@ -77,9 +77,19 @@ if(clientVars.plugins.plugins.ep_context.crudeEnterCounter >= 1){ | ||
documentAttributeManager.setAttributeOnLine(thisLine, 'context', attributes); | ||
// remove on previous line too | ||
documentAttributeManager.setAttributeOnLine(thisLine-1, 'context', attributes); | ||
}else{ | ||
// no more attributes left so remove it | ||
// documentAttributeManager.setAttributeOnLine(thisLine, 'context', ['null']); | ||
documentAttributeManager.removeAttributeOnLine(thisLine, 'context'); | ||
// remove on previous line too | ||
// documentAttributeManager.setAttributeOnLine(thisLine-1, 'context', ['null']); | ||
documentAttributeManager.removeAttributeOnLine(thisLine-1, 'context'); | ||
} | ||
return true; | ||
}else{ // first enter will keep the attribute | ||
// Make sure the line doesn't have any content in already | ||
var blankLine = call.rep.alines[thisLine] === "*0|1+1"; | ||
if(!blankLine) return; | ||
documentAttributeManager.setAttributeOnLine(thisLine, 'context', attributes); | ||
} | ||
documentAttributeManager.setAttributeOnLine(thisLine, 'context', attributes); | ||
clientVars.plugins.plugins.ep_context.crudeEnterCounter++; | ||
@@ -86,0 +96,0 @@ return true; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21132
557