Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,25 @@ ScribbleEditor::configureUsing(function (ScribbleEditor $scribble) {

## Editor Profiles

Manually, creating menu configurations for each instance of the editor can be cumbersome. To alleviate this, you can create a profile class that defines the tools for the bubble, suggestion, and toolbar menus. You can then apply the profile to the editor using the `profile` method.
Manually, creating menu configurations for each instance of the editor can be cumbersome. To alleviate this, you can create a profile class that defines the tools for the bubble, suggestion, and toolbar menus. You can then apply the profile to the editor using the `profile` method. You may use either the tool identifier for the tools class name.

```php
namespace App\ScribbleProfiles;

use Awcodes\Scribble\Facades\ScribbleFacade;
use Awcodes\Scribble\ScribbleProfile;
use Awcodes\Scribble\ScribbleProfile;use Awcodes\Scribble\Tools;

class Minimal extends ScribbleProfile
{
public static function bubbleTools(): array
{
return ScribbleFacade::getTools([
'paragraph',
'bold',
'italic',
'link',
'bullet-list',
'ordered-list',
])->toArray();
return [
Tools\Paragraph::class,
Tools\Bold::class,
Tools\Italic::class,
Tools\Link::class,
Tools\BulletList::class,
Tools\OrderedList::class,
];
}

public static function suggestionTools(): array
Expand All @@ -142,14 +141,14 @@ class Minimal extends ScribbleProfile

public static function toolbarTools(): array
{
return ScribbleFacade::getTools([
return [
'paragraph',
'bold',
'italic',
'link',
'bullet-list',
'ordered-list',
])->toArray();
];
}
}
```
Expand Down
3 changes: 3 additions & 0 deletions src/Concerns/HasBubbleTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Awcodes\Scribble\Concerns;

use Awcodes\Scribble\Facades\ScribbleFacade;
use Awcodes\Scribble\Profiles\DefaultProfile;
use Awcodes\Scribble\Tools\Link;
use Awcodes\Scribble\Wrappers\Group;
Expand All @@ -17,6 +18,8 @@ public function getBubbleTools(): array
$tools = DefaultProfile::bubbleTools();
}

$tools = ScribbleFacade::getTools($tools)->toArray();

if (! isset($tools['link'])) {
$tools['link'] = Link::make()->hidden();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Concerns/HasSuggestionTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Awcodes\Scribble\Concerns;

use Awcodes\Scribble\Facades\ScribbleFacade;
use Awcodes\Scribble\Profiles\DefaultProfile;
use Awcodes\Scribble\Wrappers\Group;
use Exception;
Expand All @@ -16,7 +17,7 @@ public function getSuggestionTools(): array
$tools = DefaultProfile::suggestionTools();
}

return $tools;
return ScribbleFacade::getTools($tools)->toArray();
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Concerns/HasToolbarTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Awcodes\Scribble\Concerns;

use Awcodes\Scribble\Facades\ScribbleFacade;
use Awcodes\Scribble\Profiles\DefaultProfile;
use Awcodes\Scribble\Tools\Link;
use Awcodes\Scribble\Wrappers\Group;
Expand Down Expand Up @@ -33,6 +34,8 @@ public function getToolbarTools(): array
$tools = DefaultProfile::toolbarTools();
}

$tools = ScribbleFacade::getTools($tools)->toArray();

if (! isset($tools['link'])) {
$tools['link'] = Link::make()->hidden();
}
Expand Down
13 changes: 6 additions & 7 deletions src/Profiles/DefaultProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace Awcodes\Scribble\Profiles;

use Awcodes\Scribble\ScribbleManager;
use Awcodes\Scribble\ScribbleProfile;

class DefaultProfile extends ScribbleProfile
{
public static function bubbleTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'heading-two',
'heading-three',
'divider',
Expand All @@ -27,25 +26,25 @@ public static function bubbleTools(): array
'align-start',
'align-center',
'align-end',
])->toArray();
];
}

public static function suggestionTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'grid',
'details',
'media',
'bullet-list',
'ordered-list',
'blockquote',
'horizontal-rule',
])->toArray();
];
}

public static function toolbarTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'heading-two',
'heading-three',
'divider',
Expand All @@ -68,6 +67,6 @@ public static function toolbarTools(): array
'align-start',
'align-center',
'align-end',
])->toArray();
];
}
}
9 changes: 4 additions & 5 deletions src/Profiles/MinimalProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

namespace Awcodes\Scribble\Profiles;

use Awcodes\Scribble\ScribbleManager;
use Awcodes\Scribble\ScribbleProfile;

class MinimalProfile extends ScribbleProfile
{
public static function bubbleTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'paragraph',
'bold',
'italic',
'link',
'bullet-list',
'ordered-list',
])->toArray();
];
}

public static function suggestionTools(): array
Expand All @@ -26,13 +25,13 @@ public static function suggestionTools(): array

public static function toolbarTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'paragraph',
'bold',
'italic',
'link',
'bullet-list',
'ordered-list',
])->toArray();
];
}
}
13 changes: 6 additions & 7 deletions src/Profiles/SimpleProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace Awcodes\Scribble\Profiles;

use Awcodes\Scribble\ScribbleManager;
use Awcodes\Scribble\ScribbleProfile;

class SimpleProfile extends ScribbleProfile
{
public static function bubbleTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'heading-two',
'heading-three',
'horizontal-rule',
Expand All @@ -22,22 +21,22 @@ public static function bubbleTools(): array
'divider',
'link',
'media',
])->toArray();
];
}

public static function suggestionTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'media',
'bullet-list',
'ordered-list',
'horizontal-rule',
])->toArray();
];
}

public static function toolbarTools(): array
{
return app(ScribbleManager::class)->getTools([
return [
'heading-two',
'heading-three',
'horizontal-rule',
Expand All @@ -50,6 +49,6 @@ public static function toolbarTools(): array
'divider',
'link',
'media',
])->toArray();
];
}
}