<commit_before><?php namespace RainLab\Editable\Components;

use File;
use BackendAuth;
use Cms\Classes\Content;
use Cms\Classes\ComponentBase;

class Editable extends ComponentBase
{

    public $content;
    public $isEditor;
    public $file;
    public $fileMode;

    public function componentDetails()
    {
        return [
            'name'        => 'Editable Component',
            'description' => 'This component allows in-context editing.'
        ];
    }

    public function defineProperties()
    {
        return [
            'file' => [
                'title'       => 'File',
                'description' => 'Content block filename to edit, optional',
                'default'     => '',
                'type'        => 'dropdown'
            ]
        ];
    }

    public function getFileOptions()
    {
        return Content::sortBy('baseFileName')->lists('baseFileName', 'fileName');
    }

    public function onRun()
    {
        $backendUser = BackendAuth::getUser();
        $this->isEditor = ($backendUser && $backendUser->hasAccess('cms.manage_content'));

        if ($this->isEditor) {
            // Piggy back the Backend's rich editor
            $this->addCss('/modules/backend/formwidgets/richeditor/assets/vendor/redactor/redactor.css');
            $this->addJs('/modules/backend/formwidgets/richeditor/assets/vendor/redactor/redactor.js');
<commit_msg>Minor<commit_after><?php namespace RainLab\Editable\Components;

use File;
use BackendAuth;
use Cms\Classes\Content;
use Cms\Classes\ComponentBase;

class Editable extends ComponentBase
{

    public $content;
    public $isEditor;
    public $file;
    public $fileMode;

    public function componentDetails()
    {
        return [
            'name'        => 'Editable Component',
            'description' => 'This component allows in-context editing.'
        ];
    }

    public function defineProperties()
    {
        return [
            'file' => [
                'title'       => 'File',
                'description' => 'Content block filename to edit, optional',
                'default'     => '',
                'type'        => 'dropdown',
            ]
        ];
    }

    public function getFileOptions()
    {
        return Content::sortBy('baseFileName')->lists('baseFileName', 'fileName');
    }

    public function onRun()
    {
        $backendUser = BackendAuth::getUser();
        $this->isEditor = ($backendUser && $backendUser->hasAccess('cms.manage_content'));

        if ($this->isEditor) {
            // Piggy back the Backend's rich editor
            $this->addCss('/modules/backend/formwidgets/richeditor/assets/vendor/redactor/redactor.css');
            $this->addJs('/modules/backend/formwidgets/richeditor/assets/vendor/redactor/redactor.js');

{'fraction_non_alphanumeric': 0.12844364937388192, 'fraction_numerical': 0.0, 'mean_word_length': 2.152198421645998, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2723068', 'n_tokens_mistral': 778, 'n_tokens_neox': 749, 'n_words': 154}