Git Product home page Git Product logo

craft-codemirror's People

Contributors

brandonkelly avatar dominicvonk avatar jeffturcotte avatar khamer avatar luwes avatar makeilalundy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

craft-codemirror's Issues

Craft 4 Support

First of all, thank you for this plugin. Now that Craft 4 is about to be released, do you plan to have the plugin ready by then?

Live Preview

CodeMirror fields don't seem to update Live Preview for me. Latest Craft and CodeMirror.

CSS syntax not working?

Cool plugin but, I'm trying to make an inline CSS editor and it's not picking up the syntax highlighting for CSS despite having CSS enabled in my modes?

Any ideas?

CRAFT 4 info

Hey :)

You said you merged PR for craft 4 ..

but still not avaible to download in Craft store..

any info on that

Unable to locate message source for category 'codemirror'.

After composer installation try to install it in the settings -> Plugins page but gives error.
I use Craft 3

Invalid Configuration – yii\base\InvalidConfigException

Unable to locate message source for category 'codemirror'.

  1. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/i18n/I18N.php at line 200
    191192193194195196197198199200201202 $source = $this->translations[''];
    if ($source instanceof MessageSource) {
    return $source;
    } else {
    return $this->translations[$category] = $this->translations['
    '] = Yii::createObject($source);
    }
    }
    }

     throw new InvalidConfigException("Unable to locate message source for category '$category'.");
    

    }
    }

  2. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/i18n/I18N.php at line 88 – yii\i18n\I18N::getMessageSource('codemirror')

  3. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/i18n/I18N.php at line 311 – yii\i18n\I18N::translate('codemirror', 'plugin loaded', [], 'fi-FI')
    305306307308309310311312313314315316317
    /**

    • @inheritdoc
      */
      public function translate($category, $message, $params, $language)
      {
      $translation = parent::translate($category, $message, $params, $language);

      if ($this->_shouldAddTranslationDebugOutput()) {
      switch ($category) {
      case 'site':
      $char = '$';
      break;

  4. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/BaseYii.php at line 509 – craft\i18n\I18N::translate('codemirror', 'plugin loaded', [], 'fi-FI')

  5. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/luwes/craft3-codemirror/src/CodeMirror.php at line 71 – yii\BaseYii::t('codemirror', 'plugin loaded')
    65666768697071727374757677 function (PluginEvent $event) {
    if ($event->plugin === $this) {
    }
    }
    );

     Craft::info('CodeMirror ' . Craft::t('codemirror', 'plugin loaded'), __METHOD__);
    

    }

    // Protected Methods
    // =========================================================================

}
6. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/base/Object.php at line 107 – luwes\codemirror\CodeMirror::init()
7. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/base/Module.php at line 158 – yii\base\Object::__construct(['name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', 'description' => 'Add the awesome in-browser code ...', ...])
8. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/base/Plugin.php at line 87 – yii\base\Module::__construct('code-mirror', craft\web\Application, ['name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', 'description' => 'Add the awesome in-browser code ...', ...])
81828384858687888990919293 }
});

    // Set this as the global instance of this plugin class
    static::setInstance($this);

    parent::__construct($id, $parent, $config);
}

/**
 * @inheritdoc
 */
public function getHandle(): string
  1. craft\base\Plugin::__construct('code-mirror', craft\web\Application, ['name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', 'description' => 'Add the awesome in-browser code ...', ...])

  2. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/di/Container.php at line 381 – ReflectionClass::newInstanceArgs(['code-mirror', craft\web\Application, ['basePath' => '/Users/digikokki/Documents/_code...', 'name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', ...]])

  3. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/di/Container.php at line 156 – yii\di\Container::build('luwes\codemirror\CodeMirror', ['code-mirror', craft\web\Application], ['basePath' => '/Users/digikokki/Documents/_code...', 'name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', ...])

  4. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/BaseYii.php at line 348 – yii\di\Container::get('luwes\codemirror\CodeMirror', ['code-mirror', craft\web\Application], ['basePath' => '/Users/digikokki/Documents/_code...', 'name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', ...])

  5. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/services/Plugins.php at line 586 – yii\BaseYii::createObject(['basePath' => '/Users/digikokki/Documents/_code...', 'name' => 'CodeMirror', 'version' => '1.0.0', 'schemaVersion' => '1.0.0', ...], ['code-mirror', craft\web\Application])
    580581582583584585586587588589590591592 $config['settings'] = $settings;
    }
    }

    // Create the plugin
    /** @var Plugin $plugin */
    $plugin = Craft::createObject($config, [$handle, Craft::$app]);
    
    if ($row !== null) {
        $this->_setPluginMigrator($plugin, $row['id']);
    }
    
    return $plugin;
    
  6. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/services/Plugins.php at line 315 – craft\services\Plugins::createPlugin('code-mirror')
    309310311312313314315316317318319320321 if (isset($this->_installedPluginInfo[$handle])) {
    // It's already installed
    return true;
    }

    /** @var Plugin $plugin */
    $plugin = $this->createPlugin($handle);
    
    // Fire a 'beforeInstallPlugin' event
    if ($this->hasEventHandlers(self::EVENT_BEFORE_INSTALL_PLUGIN)) {
        $this->trigger(self::EVENT_BEFORE_INSTALL_PLUGIN, new PluginEvent([
            'plugin' => $plugin
        ]));
    
  7. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/controllers/PluginsController.php at line 49 – craft\services\Plugins::installPlugin('code-mirror')
    43444546474849505152535455 */
    public function actionInstallPlugin(): Response
    {
    $this->requirePostRequest();
    $pluginHandle = Craft::$app->getRequest()->getRequiredBodyParam('pluginHandle');

    if (Craft::$app->getPlugins()->installPlugin($pluginHandle)) {
        Craft::$app->getSession()->setNotice(Craft::t('app', 'Plugin installed.'));
    } else {
        Craft::$app->getSession()->setError(Craft::t('app', 'Couldn’t install plugin.'));
    }
    
    return $this->redirectToPostedUrl();
    
  8. craft\controllers\PluginsController::actionInstallPlugin()

  9. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([craft\controllers\PluginsController, 'actionInstallPlugin'], [])

  10. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/base/Controller.php at line 156 – yii\base\InlineAction::runWithParams(['p' => 'admin/settings/plugins'])

  11. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/base/Module.php at line 523 – yii\base\Controller::runAction('install-plugin', ['p' => 'admin/settings/plugins'])

  12. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/web/Application.php at line 241 – yii\base\Module::runAction('plugins/install-plugin', ['p' => 'admin/settings/plugins'])
    235236237238239240241242243244245246247 * @param array $params
    *

    • @return Response|null The result of the action, normalized into a Response object
      */
      public function runAction($route, $params = [])
      {
      $result = parent::runAction($route, $params);

      if ($result !== null) {
      if ($result instanceof Response) {
      return $result;
      }

  13. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/web/Application.php at line 380 – craft\web\Application::runAction('plugins/install-plugin', ['p' => 'admin/settings/plugins'])
    374375376377378379380381382383384385386 $route = implode('/', $request->getActionSegments());

        try {
            Craft::trace("Route requested: '$route'", __METHOD__);
            $this->requestedRoute = $route;
    
            return $this->runAction($route, $_GET);
        } catch (InvalidRouteException $e) {
            throw new NotFoundHttpException(Craft::t('yii', 'Page not found.'), $e->getCode(), $e);
        }
    }
    
    return null;
    
  14. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/craftcms/cms/src/web/Application.php at line 201 – craft\web\Application::_processActionRequest(craft\web\Request)
    195196197198199200201202203204205206207 throw new ForbiddenHttpException();
    }
    }
    }

    // If this is an action request, call the controller
    if (($response = $this->_processActionRequest($request)) !== null) {
        return $response;
    }
    
    // If we're still here, finally let Yii do it's thing.
    return parent::handleRequest($request);
    

    }

  15. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/vendor/yiisoft/yii2/base/Application.php at line 380 – craft\web\Application::handleRequest(craft\web\Request)

  16. in /Users/digikokki/Documents/_code-stuff/_digikokki/Git-projektit/craft-3-cms/web/index.php at line 21 – yii\base\Application::run()
    15161718192021 $dotenv->load();
    }

// Craft
define('CRAFT_BASE_PATH', $root);
$app = require $root.'/vendor/craftcms/cms/bootstrap/web.php';
$app->run();
$_GET = [
'p' => 'admin/settings/plugins',
];

$_POST = [
'pluginHandle' => 'code-mirror',
'CRAFT_CSRF_TOKEN' => 'XbI2FHIhh4vL2LReuijUXnDHeN-B0KuUIa8UGnmM8Ts0-a1qn5kqXIy4Ph_18F2lb9JtX0YlbF0hnK_22W7IoCadXPxUuaUgtq2mGOMBJfAfizZyLp6jchH59zceQ5ENaxUoICDRZwme8yw0DZ0GL9tJB_gPZnCrObskOk6jtTdc7aQAo1H2ZbjMnkLxfF8Dn05LrX-qFwDzr4ETYJUX1piuNtbBOUmJ7rEk48wKCeOXQuxzzvy6_4lv7RGvDOXka3B7RDmnG5r-wupElAeFbxCDcVwUb9fuo77TENMb4hBCgjOK5Kfj2k_oXEg-upNsVp7JJK7Nfy_w2w99xMA_klbhDDx_EAhoEP_Kle4LrJIfqWWdNYyVQ9SckCmBNUOTe79TQxaolktwzJYPfXTwOw52EUYTslA--L4dc0X7SH--IWGfQQ9DnXeJYXEbxsJ_EoPjSPEWwAfvrvkmv00LVuwyetFbmG4kwpyley7PWrqp6QKbl2Bx7dbyfbG7bHOV4my9A_21i7X6XapD-DjQryYlPzdKlC-sv4-JEt1jsRo=',
'action' => 'plugins/install-plugin',
];

$_COOKIE = [
'CraftSessionId' => 'd2573ad6ae0b6925ecbc7b1c40df48ab',
'1031b8c41dfff97a311a7ac99863bdc5_username' => '6e998ce83802f28e32426e1860733c11edb528f965396802767b5a7ac2142fb1a:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_username";i:1;s:9:"digikokki";}',
'CRAFT_CSRF_TOKEN' => '03360ff1d090d0cf62e0df59baf79c71bc5f5774a15dbc56acf398407c064d17a:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:208:"M1GHfNPehfgNi36N2EKUewHNnGHRG6bWbgdN1TUs|c1b10b793ac95d51cec7ed2949aa50cb161b4fcd4e18659a5a8c7a6ec9f3c77fM1GHfNPehfgNi36N2EKUewHNnGHRG6bWbgdN1TUs|1|$2y$13$hNZMl1G4MVY8d8CYRwfzvu.Qp3I1Js2GRW45KMUDss346AMcVId4u";}',
'1031b8c41dfff97a311a7ac99863bdc5_identity' => 'b176f68502912755168b07362e2ad72e1c5778ef525411a3ae26d1d07e7585b8a:2:{i:0;s:41:"1031b8c41dfff97a311a7ac99863bdc5_identity";i:1;s:286:"["1","[\"jY2ZMYkUJ3lGjhlM7HJGvYcn9tPB61ngc-GhkyIle3QKdlTifyPXrwOnVdtWutyAjsTkXpuX3mSpYBy9X4nW4RDdCOUg1xwhkvub\",\"7d4c2791-7af9-4b95-b2de-ad962bbbbb77\",\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36\"]",3600]";}',
];

$_SESSION = [
'bd62416aa8538ede709019a5e113eea5__flash' => [],
'bd62416aa8538ede709019a5e113eea5__auth_access' => [
'saveAssetInVolume:1',
],
'1031b8c41dfff97a311a7ac99863bdc5__id' => '1',
'1031b8c41dfff97a311a7ac99863bdc5__expire' => 1501768094,
];
Yii Framework
2017-08-03, 15:48:14

Apache
Yii Framework/2.0.12

FR: Custom themes not overwritten when updating

Would be great if a custom theme could be configured so it can be referenced outside of the theme folder and therefore not deleted when updating the plugin.

Workaround is to use the CP CSS plugin to include the CodeMirror theme css.

Content of Codemirror Field is Deleted on Save in Craft 3.2.1

I have a Codemirror field that is required on an entry in my Craft instance. When I try to save the entry, the content that is entered in the Codemirror field gets deleted and the field throws an error saying "[Field name] cannot be blank." and the entry cannot be saved (since the field is required).

Craft CMS Version 3.2.1

I originally noticed this broke when my site updated to 3.2 beta versions and thought maybe the official release would fix, but looks like that's not the case.

If you need any additional information, please let me know! Thanks!

Emoji characters are not allowed

I have a client who was using this field and tried to embed a tweet that contained a 📣 emoji.
Upon saving the entry I get a Code Embed cannot contain emoji. error (Code Embed is the name of the field).

I'm looking at other/better options for embedding tweets but is there some way that this field could be updated with emoji support?

JavaScript JSON mode

CodeMirror JavaScript mode supports additional configuration options, allowing to display json, json-ld and typescript (doc)

I need the JSON mode, not sure how this could be configured right now.

CodeMirror supports using mime types as mode values, and then it automatically maps to correct mode, setting application/json is internally replaced with json: true, mode: javascript but setting mime type in the plugin config does not works correctly as it tries to load a js file mode/application/json.js that actually is not there.

This could be fixed by using the same mode resolving logic that CodeMirror has - https://github.com/codemirror/codemirror5/blob/e84384b4210bc35300994de07c6333666f2a5c9e/src/modes.js#L20C1-L20C1 and https://github.com/codemirror/codemirror5/blob/e84384b4210bc35300994de07c6333666f2a5c9e/mode/javascript/javascript.js#L953

How to use in custom plugins?

Is it possible to use this field in custom plugins?
For example;

{% if craft.app.plugins.isPluginEnabled('code-mirror') %}

    CODE MIRROR FIELD HERE

{% else %}
    {{ forms.textareaField({
        label: 'Template'|t('app'),
        name: 'template',
        value: template,
        rows: 8,
        errors: model.getErrors('template'),
    }) }}
{% endif %}

Couldn't find anything about it.. do you know?

Craft 5

Any plans for an update to support Craft 5?

Disable scrolling

How to turn off scrolling. To make the code increase the size of the container. Without enabling scrolling ?

Снимок экрана 2021-12-21 в 18 32 14 (2)

And automatically close the tags ?

"AxiosError", code: "ERR_BAD_REQUEST"

have last version of Craft 4.3 and last version of code miror.
getting this,,,

Snag_15d4cd85
Snag_15d4d778

there is issue with VIZY too.
i solved by changing plugin settings..

return [ 'addons' => [ 'mode/overlay', 'mode/simple', ] ];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.