You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/01/19 14:46:36 UTC
[GitHub] [couchdb-fauxton] rhyshort opened a new pull request #1331: Replace brace with ace-build and react-ace
rhyshort opened a new pull request #1331:
URL: https://github.com/apache/couchdb-fauxton/pull/1331
<!-- Thank you for your contribution!
Please file this form by replacing the Markdown comments
with your text. If a section needs no action - remove it.
Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
of code collaboration. Positive feedback is represented +1 from committers
and negative is a -1. The -1 also means veto, and needs to be addressed
to proceed. Once there are no objections, the PR can be merged by a
CouchDB committer.
See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
## Overview
To enable users to remove the CSP directive `style-src unsafe-inline`, the
ace editor version needs to be upgraded to at least 1.4.13 which
includes the global option `useStrictCSP`. In order to do this
brace has had to be replaced since it hasn't had an update in 4 years.
react-ace is chosen as a replacement as it uses ace-builds and wraps
ace in a react component. The option `useStrictCSP` is enabled,
with the required style sheets imported, where possible properties
that can be handled by react-ace are passed directly to `AceEditor`
as part of the `render()` call, otherwise customizations are left
to be handled by the codeeditor component.
## Testing recommendations
<!-- Describe how we can test your changes.
Does it provides any behaviour that the end users
could notice? -->
The changes should be covered by the existing nightwatch tests and from an end user perspective the changes should be not be noticable.
## GitHub issue number
<!-- If this is a significant change, please file a separate issue at:
https://github.com/apache/couchdb-fauxton/issues
and include the number here and in commit message(s) using
syntax like "Fixes #472" or "Fixes apache/couchdb#472". -->
n/a
## Related Pull Requests
<!-- If your changes affects multiple components in different
repositories please put links to those pull requests here. -->
n/a
## Checklist
- [x] Code is written and works correctly;
- [x] Changes are covered by tests;
- [ ] Documentation reflects the changes;
- [ ] Update [rebar.config.script](https://github.com/apache/couchdb/blob/main/rebar.config.script) with the correct tag once a new Fauxton release is made
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-fauxton] rhyshort commented on a change in pull request #1331: Replace brace with ace-build and react-ace
Posted by GitBox <gi...@apache.org>.
rhyshort commented on a change in pull request #1331:
URL: https://github.com/apache/couchdb-fauxton/pull/1331#discussion_r788576695
##########
File path: app/addons/components/components/zenmodeoverlay.js
##########
@@ -15,7 +15,7 @@ import app from "../../../app";
import {CodeEditor} from './codeeditor';
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
-require('brace/theme/dawn');
+require('ace-builds/src-min-noconflict/theme-dawn');
Review comment:
done
##########
File path: app/addons/documents/rev-browser/components/splitscreenarea.js
##########
@@ -12,16 +12,13 @@
import React from 'react';
import ReactDOM from "react-dom";
-import ace from "brace";
-require('brace/ext/static_highlight');
-const highlight = ace.acequire('ace/ext/static_highlight');
+const highlight = require('ace-builds/src-min-noconflict/ext-static_highlight');
-require('brace/mode/json');
-const JavaScriptMode = ace.acequire('ace/mode/json').Mode;
+require('ace-builds/src-min-noconflict/mode-json');
+const JavaScriptMode = require('ace-builds/src-min-noconflict/mode-javascript').Mode;
Review comment:
fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-fauxton] Antonio-Maranhao commented on a change in pull request #1331: Replace brace with ace-build and react-ace
Posted by GitBox <gi...@apache.org>.
Antonio-Maranhao commented on a change in pull request #1331:
URL: https://github.com/apache/couchdb-fauxton/pull/1331#discussion_r788073586
##########
File path: app/addons/documents/rev-browser/components/splitscreenarea.js
##########
@@ -12,16 +12,13 @@
import React from 'react';
import ReactDOM from "react-dom";
-import ace from "brace";
-require('brace/ext/static_highlight');
-const highlight = ace.acequire('ace/ext/static_highlight');
+const highlight = require('ace-builds/src-min-noconflict/ext-static_highlight');
-require('brace/mode/json');
-const JavaScriptMode = ace.acequire('ace/mode/json').Mode;
+require('ace-builds/src-min-noconflict/mode-json');
+const JavaScriptMode = require('ace-builds/src-min-noconflict/mode-javascript').Mode;
Review comment:
I noticed syntax highlighting was a bit different in the rev-browser, and it's because the mode here is wrong. It should be `mode-json`.
Please fix the var name as well.
##########
File path: app/addons/components/components/zenmodeoverlay.js
##########
@@ -15,7 +15,7 @@ import app from "../../../app";
import {CodeEditor} from './codeeditor';
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
-require('brace/theme/dawn');
+require('ace-builds/src-min-noconflict/theme-dawn');
Review comment:
Dawn theme was not getting applied. I had to add `import 'ace-builds/css/theme/dawn.css';` here to make it work.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-fauxton] Antonio-Maranhao merged pull request #1331: Replace brace with ace-build and react-ace
Posted by GitBox <gi...@apache.org>.
Antonio-Maranhao merged pull request #1331:
URL: https://github.com/apache/couchdb-fauxton/pull/1331
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb-fauxton] Antonio-Maranhao commented on a change in pull request #1331: Replace brace with ace-build and react-ace
Posted by GitBox <gi...@apache.org>.
Antonio-Maranhao commented on a change in pull request #1331:
URL: https://github.com/apache/couchdb-fauxton/pull/1331#discussion_r787835305
##########
File path: app/addons/components/components/codeeditor.js
##########
@@ -11,13 +11,20 @@
// the License.
import React from "react";
import FauxtonAPI from "../../../core/api";
-import ace from "brace";
-import "brace/ext/searchbox";
+import AceEditor from "react-ace";
+import ace from 'ace-builds';
+import "ace-builds/src-min-noconflict/ext-searchbox";
import {StringEditModal} from './stringeditmodal';
+import 'ace-builds/css/theme/idle_fingers.css';
+import 'ace-builds/css/ace.css';
+// importing the webpack resolver enables syntax checking
Review comment:
```suggestion
// importing the webpack resolver enables dynamically loading modes, which is required for syntax checking
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org