diff --git a/package.json b/package.json
index b02ed0fd..d3f83e91 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"@quasar/extras": "^1.16.2",
"@tauri-apps/api": "^1.0.0-beta.8",
"core-js": "^3.30.1",
+ "direction": "^2.0.1",
"es6-promise": "^4.2.8",
"quasar": "^2.11.10",
"treebank-tokenizer": "^0.0.1",
@@ -27,12 +28,12 @@
"vuex": "^4.1.0"
},
"devDependencies": {
+ "@babel/eslint-parser": "^7.21.3",
"@tauri-apps/cli": "^1.0.0-beta.10",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/compiler-sfc": "^3.2.47",
- "@babel/eslint-parser": "^7.21.3",
"eslint": "^8.38.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
diff --git a/src/components/AnnotationPage.vue b/src/components/AnnotationPage.vue
index 1cceb909..aa172d75 100644
--- a/src/components/AnnotationPage.vue
+++ b/src/components/AnnotationPage.vue
@@ -3,7 +3,8 @@
[spans[i][0], spans[i][1], t]);
this.tm = new TokenManager(this.classes);
this.tm.setTokensAndAnnotation(combined, this.currentAnnotation);
},
+
+ /*if ltr and rtl text both exist in the same file
+ then the tokens are generated in one direction based on users input
+ which causes one direction(ltr or rtl) of the texts to be in reverse.
+ To handle that the tokens that should be in the opposite direction is reversed*/
+ handleRtlAndLtrMix(tokens){
+ /* initialize an empty map where key will be start index
+ and the value will be total number of consecutive opposite direction texts*/
+ const indexMap = new Map();
+
+ for(let i = 0; i
+
-
+
{{ token.label }}
diff --git a/src/components/sidebar/TextDirectionSelector.vue b/src/components/sidebar/TextDirectionSelector.vue
new file mode 100644
index 00000000..a2d815c4
--- /dev/null
+++ b/src/components/sidebar/TextDirectionSelector.vue
@@ -0,0 +1,56 @@
+
+
+
+
+
diff --git a/src/store/index.js b/src/store/index.js
index 9c7ba0ec..5924bc15 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -73,6 +73,9 @@ export const mutations = {
setAnnotationPrecision(state, payload) {
state.annotationPrecision = payload;
},
+ setTextDirection(state, payload) {
+ state.textDirection = payload;
+ },
setKeyboardShortcuts(state, payload) {
state.enableKeyboardShortcuts = payload;
},
@@ -189,6 +192,7 @@ export default {
separator: "\n",
enableKeyboardShortcuts: false,
annotationPrecision: "word",
+ textDirection: "ltr",
// current state
currentAnnotation: {},
currentClass: tags && tags[0] || {},
diff --git a/yarn.lock b/yarn.lock
index 0e36b19a..60ab9275 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4371,6 +4371,11 @@ dir-glob@^3.0.1:
dependencies:
path-type "^4.0.0"
+direction@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.npmjs.org/direction/-/direction-2.0.1.tgz#71800dd3c4fa102406502905d3866e65bdebb985"
+ integrity sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==
+
dns-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d"