Skip to content

Commit

Permalink
Merge pull request mostafaznv#13 from mostafaznv/dev
Browse files Browse the repository at this point in the history
configurable 3-dots mode on overflowing. mostafaznv#12
  • Loading branch information
mostafaznv authored May 21, 2022
2 parents aa9b7c9 + 32fde5b commit 5673a95
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,16 @@ $this->app->bind('ckeditor-image-storage', MyImageStorage::class);

## CkEditor Field Options

| method | Type | default | description |
|------------------|---------|------------------|-----------------------------------------------------------------------------------------------|
| toolbar | Array | from config file | Set toolbar items |
| height | Integer | from config file | Set editor's height |
| limitOnIndex | Integer | 85 | Set character limit on index |
| contentLanguage | Integer | from config file | Language of editor's content. if you want to change text-direction (RTL, LTR), you need this |
| imageBrowser | Boolean | from config file | Enable/Disable image picker |
| videoBrowser | Boolean | from config file | Enable/Disable video picker |
| snippets | Array | from config file | Set Snippet items |
| method | Type | default | description |
|------------------------|---------|------------------|----------------------------------------------------------------------------------------------|
| toolbar | Array | from config file | Set toolbar items |
| height | Integer | from config file | Set editor's height |
| limitOnIndex | Integer | 85 | Set character limit on index |
| contentLanguage | Integer | from config file | Language of editor's content. if you want to change text-direction (RTL, LTR), you need this |
| shouldNotGroupWhenFull | Boolean | from config file | Indicates whether the editor shows 3 dots in overflow mode |
| imageBrowser | Boolean | from config file | Enable/Disable image picker |
| videoBrowser | Boolean | from config file | Enable/Disable video picker |
| snippets | Array | from config file | Set Snippet items |



Expand Down Expand Up @@ -228,6 +229,11 @@ Editor's height.

Language of editor's content. if you want to change text-direction (RTL, LTR), you need this

#### Should Not Group When Full
`boolean` `default: false`

Indicates whether the editor shows 3 dots in overflow mode

#### Browser
`boolean` `default: true`

Expand Down
2 changes: 2 additions & 0 deletions config/nova-ckeditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@

'content-lang' => 'en',

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

'browser' => [
'image' => true,
'video' => true
Expand Down
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion resources/js/components/editor-field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ export default {
ui: 'en',
content: this.field.contentLanguage
},
toolbar: {items: this.field.toolbar},
toolbar: {
items: this.field.toolbar,
shouldNotGroupWhenFull: this.field.shouldNotGroupWhenFull
},
...this.field.toolbarOptions
}
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;

/**
* Indicates whether the editor shows 3 dots in overflow mode
*
* @var bool
*/
public bool $shouldNotGroupWhenFull = false;

/**
* Indicates whether the image browser should be available
*
Expand Down Expand Up @@ -86,6 +93,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->shouldNotGroupWhenFull = $config['toolbar']['should-not-group-when-full'];
$this->videoModel = $config['video-model'];
}

Expand Down Expand Up @@ -142,6 +150,19 @@ public function contentLanguage(string $lang): self
return $this;
}

/**
* Set Should Not Group When Full
*
* @param bool $status
* @return $this
*/
public function shouldNotGroupWhenFull(bool $status = true): self
{
$this->shouldNotGroupWhenFull = $status;

return $this;
}

/**
* Enable/Disable Image Browser
*
Expand Down Expand Up @@ -197,6 +218,7 @@ public function jsonSerialize(): array
'height' => $this->height,
'indexLimit' => $this->indexLimit,
'contentLanguage' => $this->contentLanguage,
'shouldNotGroupWhenFull' => $this->shouldNotGroupWhenFull,
'shouldShow' => $this->shouldBeExpanded(),
'videoHasLaruploadTrait' => $this->hasLaruploadTrait(),
]);
Expand Down

0 comments on commit 5673a95

Please sign in to comment.