Skip to content

Commit

Permalink
Merge pull request #38 from mostafaznv/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mostafaznv authored Jan 8, 2023
2 parents 83f2616 + c2f7600 commit b13a748
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 31 deletions.
58 changes: 30 additions & 28 deletions README.md

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion config/nova-ckeditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
|
*/

'image-naming-method' => 'hash-file',
'image-naming-method' => 'hash-file',

/*
|--------------------------------------------------------------------------
Expand All @@ -85,6 +85,11 @@
'script' => null
],

'text-part-language' => [
['title' => 'Farsi', 'languageCode' => 'fa'],
['title' => 'English', 'languageCode' => 'en']
],

'should-not-group-when-full' => false,

'browser' => [
Expand All @@ -98,7 +103,14 @@
['name' => 'Table', 'html' => 'ckeditor.table']
],

'languages' => [
['name' => 'Image', 'html' => 'ckeditor.image'],
['name' => 'Media', 'html' => 'ckeditor.media'],
['name' => 'Table', 'html' => 'ckeditor.table']
],

'items' => [
'textPartLanguage',
'heading',
'|',
'fontSize',
Expand Down
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"webpack": "^5.9.0"
},
"dependencies": {
"@ckeditor/ckeditor5-language": "^35.4.0",
"lodash": "^4.17.21",
"postcss-scss": "^4.0.4",
"vue": "^3.2.29"
Expand Down
2 changes: 2 additions & 0 deletions resources/js/ckeditor/ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock'
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'
import Heading from '@ckeditor/ckeditor5-heading/src/heading'
import List from '@ckeditor/ckeditor5-list/src/list'
import TextPartLanguage from '@ckeditor/ckeditor5-language/src/textpartlanguage'

// Font
import Font from '@ckeditor/ckeditor5-font/src/font'
Expand Down Expand Up @@ -90,6 +91,7 @@ export default class CkEditor extends ClassicEditorBase {
Link,
List,
Heading,
TextPartLanguage,
Paragraph,
BlockQuote,
CodeBlock,
Expand Down
3 changes: 2 additions & 1 deletion resources/js/components/editor-field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export default {
isReadOnly: this.field.readonly,
language: {
ui: this.field.uiLanguage,
content: this.field.contentLanguage
content: this.field.contentLanguage,
textPartLanguage: this.field.textPartLanguage
},
toolbar: {
items: this.field.toolbar,
Expand Down
22 changes: 22 additions & 0 deletions src/CkEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ class CkEditor extends Field
*/
public string $contentLanguage;

/**
* Text Part Language
*
* @var array
*/
public array $textPartLanguage;

/**
* UI Language
*
Expand Down Expand Up @@ -100,6 +107,7 @@ public function __construct($name, $attribute = null, callable $resolveCallback
$this->videoBrowser = $config['toolbar']['browser']['video'];
$this->snippetBrowser = $this->prepareSnippets($config['toolbar']['snippets']);
$this->contentLanguage = $config['toolbar']['content-lang'];
$this->textPartLanguage = $config['toolbar']['text-part-language'];
$this->uiLanguage = $config['toolbar']['ui-language']['name'] ?? 'en';
$this->shouldNotGroupWhenFull = $config['toolbar']['should-not-group-when-full'];
$this->videoModel = $config['video-model'];
Expand Down Expand Up @@ -158,6 +166,19 @@ public function contentLanguage(string $lang): self
return $this;
}

/**
* Set Text Part Language
*
* @param array $languages
* @return $this
*/
public function textPartLanguage(array $languages): self
{
$this->textPartLanguage = $languages;

return $this;
}

/**
* Set Should Not Group When Full
*
Expand Down Expand Up @@ -226,6 +247,7 @@ public function jsonSerialize(): array
'height' => $this->height,
'indexLimit' => $this->indexLimit,
'contentLanguage' => $this->contentLanguage,
'textPartLanguage' => $this->textPartLanguage,
'uiLanguage' => $this->uiLanguage,
'shouldNotGroupWhenFull' => $this->shouldNotGroupWhenFull,
'shouldShow' => $this->shouldBeExpanded(),
Expand Down

0 comments on commit b13a748

Please sign in to comment.