This commit is contained in:
Niqui O'Neill 2020-11-25 12:00:10 -08:00
commit ffd6fc5c00
8 changed files with 54 additions and 31 deletions

36
package-lock.json generated
View File

@ -1650,6 +1650,11 @@
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"dev": true
},
"autosize": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/autosize/-/autosize-4.0.2.tgz",
"integrity": "sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA=="
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
@ -2427,6 +2432,11 @@
"resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.14.tgz",
"integrity": "sha512-mKDjINe3tc6hGelUMNDzuhorIUZ7kS7BwyY0r2wQd2HOH2tRuJykiC06iSEX8y1TuhNzvz4GcJnK16mM2J1NMQ=="
},
"computed-style": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/computed-style/-/computed-style-0.1.4.tgz",
"integrity": "sha1-fzRP2FhLLkJb7cpKGvwOMAuwXXQ="
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -3435,11 +3445,6 @@
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true
},
"fast-deep-equal": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
},
"fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@ -5170,6 +5175,14 @@
"leven": "^3.1.0"
}
},
"line-height": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/line-height/-/line-height-0.3.1.tgz",
"integrity": "sha1-SxIF7d4YKHKl76PI9iCzGHqcVMk=",
"requires": {
"computed-style": "~0.1.3"
}
},
"lines-and-columns": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
@ -7130,13 +7143,14 @@
}
}
},
"react-contenteditable": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/react-contenteditable/-/react-contenteditable-3.3.3.tgz",
"integrity": "sha512-3sOt9x6A7SzHqJgFRqKfaUnIh2tdxrdnJcE/0g1dN/g3twsqNxMxUCJGWvZUUDIQjUzqdSz6tsnGdddrPr5UNg==",
"react-autosize-textarea": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/react-autosize-textarea/-/react-autosize-textarea-7.1.0.tgz",
"integrity": "sha512-BHpjCDkuOlllZn3nLazY2F8oYO1tS2jHnWhcjTWQdcKiiMU6gHLNt/fzmqMSyerR0eTdKtfSIqtSeTtghNwS+g==",
"requires": {
"fast-deep-equal": "^2.0.1",
"prop-types": "^15.7.1"
"autosize": "^4.0.2",
"line-height": "^0.3.1",
"prop-types": "^15.5.6"
}
},
"react-input-autosize": {

View File

@ -46,7 +46,7 @@
"downshift": "^5.4.6",
"node-polyglot": "^2.4.0",
"preact": "^10.4.1",
"react-contenteditable": "^3.3.3",
"react-autosize-textarea": "^7.1.0",
"react-select": "^3.1.1",
"react-transition-group": "^4.3.0",
"timeago-react": "^3.0.1",

View File

@ -39,8 +39,8 @@ const CommentWidget = props => {
const comments = all.filter(b => b != draftReply);
const onEditReply = evt => {
const prev = draftReply.value.trim();
const updated = evt.target.value.trim();
const prev = draftReply.value;
const updated = evt.target.value;
if (prev.length === 0 && updated.length > 0) {
props.onAppendBody({ ...draftReply, value: updated });

View File

@ -1,13 +1,9 @@
import React, { Component } from 'preact/compat';
import ContentEditable from 'react-contenteditable';
import TextareaAutosize from 'react-autosize-textarea';
import i18n from '../../../i18n';
/**
* A basic text entry field, for reuse in different widgets.
*
* Note that react-contenteditable seems to have compatibility
* issues with React hooks, therefore this component is
* implemented as a class.
*/
export default class TextEntryField extends Component {
@ -19,17 +15,16 @@ export default class TextEntryField extends Component {
// Focus on render
onRender = ref => {
if (ref && this.props.editable)
setTimeout(() => ref.focus(), 1);
// Note: we could use this to set automatic focus (but leave this out for now)
}
render() {
return (
<ContentEditable
innerRef={this.onRender}
<TextareaAutosize
ref={this.onRender}
className="r6o-editable-text"
html={this.props.content}
data-placeholder={this.props.placeholder || i18n.t('Add a comment...')}
value={this.props.content}
placeholder={this.props.placeholder || i18n.t('Add a comment...')}
disabled={!this.props.editable}
onChange={this.props.onChange}
onKeyDown={this.onKeyDown} />

View File

@ -18,6 +18,7 @@ import hi from 'timeago.js/lib/lang/hi_IN';
import it from 'timeago.js/lib/lang/it';
import pt from 'timeago.js/lib/lang/pt_BR';
import sv from 'timeago.js/lib/lang/sv';
import tr from 'timeago.js/lib/lang/tr';
// import ur from 'timeago.js/lib/lang/ur'; // Not currently supported by TimeAgo
timeago.register('ar', ar);
@ -29,5 +30,6 @@ timeago.register('hi', hi);
timeago.register('it', it);
timeago.register('pt', pt);
timeago.register('sv', sv);
timeago.register('tr', tr);
export default i18n;
export default i18n;

10
src/i18n/messages_tr.json Normal file
View File

@ -0,0 +1,10 @@
{
"Add a comment...": "Yorum ekle...",
"Add a reply...": "Cevap ekle...",
"Add tag...": "Tag Ekle...",
"Cancel": "İptal",
"Close": "Kapat",
"Edit": "Düzenle",
"Delete": "Sil",
"Ok": "Tamam"
}

View File

@ -17,10 +17,6 @@ const getContent = relation => {
* to be used separately by the implementing application. We
* still keep it in the /recogito-relations folder though, so that
* all code that belongs together stays together.
*
* Note that react-contenteditable seems to have compatibility
* issues with React hooks, therefore this component is implemented
* as a class.
*/
export default class RelationEditor extends Component {

View File

@ -6,7 +6,13 @@
.r6o-editable-text,
.r6o-readonly-comment {
padding:8px 10px;
padding:10px;
width:100%;
box-sizing:border-box;
outline:none;
border:none;
background-color:transparent;
resize:none;
}
.r6o-lastmodified {