You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by hu...@apache.org on 2019/08/02 17:18:30 UTC
svn commit: r1864244 - in /comdev/reporter.apache.org/trunk/site/wizard:
css/wizard.css index.html js/source/generators.js js/source/unified.js
js/wizard.js
Author: humbedooh
Date: Fri Aug 2 17:18:29 2019
New Revision: 1864244
URL: http://svn.apache.org/viewvc?rev=1864244&view=rev
Log:
- tweak reflower
- detect overflowing text and offer to fix it
Modified:
comdev/reporter.apache.org/trunk/site/wizard/css/wizard.css
comdev/reporter.apache.org/trunk/site/wizard/index.html
comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
Modified: comdev/reporter.apache.org/trunk/site/wizard/css/wizard.css
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/css/wizard.css?rev=1864244&r1=1864243&r2=1864244&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/css/wizard.css (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/css/wizard.css Fri Aug 2 17:18:29 2019
@@ -275,9 +275,17 @@
font-size: 0.9rem !important;
}
+#unified-reflow {
+ width: 540px;
+ height: 20px;
+ font-size: 11px;
+
+}
+
+
#unified-report {
width: 540px;
- height: 590px;
+ height: 570px;
font-size: 11px;
}
Modified: comdev/reporter.apache.org/trunk/site/wizard/index.html
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/index.html?rev=1864244&r1=1864243&r2=1864244&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/index.html (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/index.html Fri Aug 2 17:18:29 2019
@@ -35,6 +35,7 @@ let editor_type = 'unified';
</div>
<div id="unified-editor">
+ <div id="unified-reflow"></div>
<textarea id="unified-report"></textarea>
</div>
<div id="unified-helper"></div>
Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js?rev=1864244&r1=1864243&r2=1864244&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js Fri Aug 2 17:18:29 2019
@@ -247,8 +247,8 @@ function activity_tips(data) {
}
function reflow(txt, chars) {
- chars = chars || 70;
- let words = txt.match(/([\S+?]+\s+?)/mg);
+ chars = chars || 78;
+ let words = txt.match(/([\S+?]+\s*)/mg);
if (!words) return txt;
let x = 0;
let output = "";
Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js?rev=1864244&r1=1864243&r2=1864244&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js Fri Aug 2 17:18:29 2019
@@ -20,12 +20,35 @@ function UnifiedEditor_highlight_section
// If additional text is marked for highlighting, we'll have to
// first destroy any original highlighting, as it's params changed!
if (additional_text) {
+ let color = 'green'
+
+ // Check for overflow, offer reflowing
+ let reflower = document.getElementById('unified-reflow');
+ if (reflower) {
+ let stripped = additional_text.replace(/(^\s+|\s+$)/, '')
+ if (reflow(stripped) != stripped) {
+ color = 'red';
+ reflower.innerHTML = "SECTION IS OVERFLOWING 80 CHARACTERS!";
+ let btn = new HTML('button', {class: 'btn btn-success btn-sm'}, "Reflow section");
+ btn.addEventListener('click', () => {
+ this.object.value = this.object.value.replace(additional_text, reflow(additional_text));
+ $(this.object).prop( {
+ 'selectionStart': x,
+ 'selectionEnd': y}
+ );
+ this.find_section();
+ });
+ reflower.inject(btn);
+ } else {
+ reflower.innerHTML = "";
+ }
+ }
$('#unified-report').highlightWithinTextarea('destroy');
// Sections are marked light green
hilites.push({
highlight: additional_text,
- className: 'green'
+ className: color
});
}
Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864244&r1=1864243&r2=1864244&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Fri Aug 2 17:18:29 2019
@@ -1416,8 +1416,8 @@ function activity_tips(data) {
}
function reflow(txt, chars) {
- chars = chars || 70;
- let words = txt.match(/([\S+?]+\s+?)/mg);
+ chars = chars || 78;
+ let words = txt.match(/([\S+?]+\s*)/mg);
if (!words) return txt;
let x = 0;
let output = "";
@@ -1920,12 +1920,35 @@ function UnifiedEditor_highlight_section
// If additional text is marked for highlighting, we'll have to
// first destroy any original highlighting, as it's params changed!
if (additional_text) {
+ let color = 'green'
+
+ // Check for overflow, offer reflowing
+ let reflower = document.getElementById('unified-reflow');
+ if (reflower) {
+ let stripped = additional_text.replace(/(^\s+|\s+$)/, '')
+ if (reflow(stripped) != stripped) {
+ color = 'red';
+ reflower.innerHTML = "SECTION IS OVERFLOWING 80 CHARACTERS!";
+ let btn = new HTML('button', {class: 'btn btn-success btn-sm'}, "Reflow section");
+ btn.addEventListener('click', () => {
+ this.object.value = this.object.value.replace(additional_text, reflow(additional_text));
+ $(this.object).prop( {
+ 'selectionStart': x,
+ 'selectionEnd': y}
+ );
+ this.find_section();
+ });
+ reflower.inject(btn);
+ } else {
+ reflower.innerHTML = "";
+ }
+ }
$('#unified-report').highlightWithinTextarea('destroy');
// Sections are marked light green
hilites.push({
highlight: additional_text,
- className: 'green'
+ className: color
});
}