/**
* Edit Control - Document editing tools and actions
* Implements the Robustness Principle with Fail Fast mode support
*/
class EditControl {
constructor() {
this.control = Object.create(Control);
this.control.config = {
icon: '✏️',
title: 'Edit',
className: 'edit-control',
defaultContent: 'Document editing tools',
ariaLabel: 'Edit Control',
position: 'e'
};
// Bind methods to control
this.control.buildContent = () => {
const content = this.control.element.querySelector('.control-content');
content.innerHTML = `
Edit Tools
Page Info:
Title: ${document.title}
Words: ~${(document.body.textContent || '').split(/\\s+/).filter(w => w.length > 0).length}
Modified: ${document.lastModified}
`;
this.control.isExpanded = true;
};
this.control.toggle = () => {
if (this.control.isExpanded) {
this.control.element.querySelector('.control-content').style.display = 'none';
this.control.isExpanded = false;
} else {
this.control.buildContent();
this.control.element.querySelector('.control-content').style.display = 'block';
}
};
}
createControl() {
return this.control.createControl();
}
}
window.EditControl = EditControl;