mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
Remove terrible hack for setting the dc:creator
field's text in an annotation; now that we have first-class access to member data, we can set this value directly within OpAddAnnotation.
This commit is contained in:
@@ -220,29 +220,6 @@ gui.AnnotationViewManager = function AnnotationViewManager(odfCanvas, odfFragmen
|
||||
connectorAngular.style.MozTransform = 'rotate(' + connectorAngle + 'rad)';
|
||||
connectorAngular.style.WebkitTransform = 'rotate(' + connectorAngle + 'rad)';
|
||||
connectorAngular.style.msTransform = 'rotate(' + connectorAngle + 'rad)';
|
||||
|
||||
// Bad hack: Since we do not have a straightforward way to access member data here, we will read the computed style
|
||||
// of dc:creator[editinfo|memberid]:before, always applied by SessionView, because that contains the creator name
|
||||
// as the content, when an annotation is created by OpAddAnnotation.
|
||||
if (creatorNode) {
|
||||
creatorName = window.getComputedStyle(/**@type{!Element}*/(creatorNode), ':before').content;
|
||||
// The default `content: ` value for :before and :after pseudo-elements
|
||||
// in webkit is '' and `none` in gecko.
|
||||
if (creatorName && creatorName !== 'none') {
|
||||
// Strip possible opening and closing quotes
|
||||
/*jslint regexp: true*/ // jslint complains otherwise about "Insecure '.'"
|
||||
if (/^["'].*["']$/.test(creatorName)) {
|
||||
creatorName = creatorName.substring(1, creatorName.length - 1);
|
||||
}
|
||||
/*jslint regexp: false*/
|
||||
if (creatorNode.firstChild) {
|
||||
creatorNode.firstChild.nodeValue = creatorName;
|
||||
} else {
|
||||
creatorNode.appendChild(doc.createTextNode(creatorName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,7 +163,6 @@ gui.SessionView = (function () {
|
||||
setStyle('div.editInfoMarker', '{ background-color: ' + color + '; }', '');
|
||||
setStyle('span.editInfoColor', '{ background-color: ' + color + '; }', '');
|
||||
setStyle('span.editInfoAuthor', '{ content: "' + name + '"; }', ':before');
|
||||
setStyle('dc|creator', '{ content: "' + name + '"; display: none;}', ':before');
|
||||
setStyle('dc|creator', '{ background-color: ' + color + '; }', '');
|
||||
setStyle('div.selectionOverlay', '{ background-color: ' + color + ';}', '');
|
||||
}
|
||||
|
||||
@@ -72,10 +72,9 @@ ops.OpAddAnnotation = function OpAddAnnotation() {
|
||||
annotationNode = doc.createElementNS(odf.Namespaces.officens, 'office:annotation');
|
||||
annotationNode.setAttributeNS(odf.Namespaces.officens, 'office:name', name);
|
||||
|
||||
// Only set the memberid attribute on dc:creator. Let the annotation manager actually set the name
|
||||
// for now
|
||||
creatorNode = doc.createElementNS(odf.Namespaces.dcns, 'dc:creator');
|
||||
creatorNode.setAttributeNS('urn:webodf:names:editinfo', 'editinfo:memberid', memberid);
|
||||
creatorNode.textContent = odtDocument.getMember(memberid).getProperties().fullName;
|
||||
|
||||
// Date.toISOString return the current Dublin Core representation
|
||||
dateNode = doc.createElementNS(odf.Namespaces.dcns, 'dc:date');
|
||||
|
||||
Reference in New Issue
Block a user