Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robin Hansen 135 posts 368 karma points
    Oct 06, 2015 @ 10:24
    Robin Hansen
    0

    Codemirror textarea as datatype

    I would like to make a codemirror textarea as a datatype. I can easily create a textarea on the frontend and convert it into a code area using Umbraco's native files:

    <link href="~/umbraco_client/CodeMirror/Js/Lib/codemirror.css" rel="stylesheet" />
    
    
    <script src="~/umbraco_client/CodeMirror/Js/Lib/codemirror.js"></script>
    
    
    
    
    <script src="~/umbraco_client/CodeMirror/Js/Mode/Xml/xml.js"></script>
    
    
    
    
    <script src="~/umbraco_client/CodeMirror/Js/Mode/Javascript/javascript.js"></script>
    
    
    
    
    <script src="~/umbraco_client/CodeMirror/Js/Mode/Css/css.js"></script>
    
    
    
    
    <script src="~/umbraco_client/CodeMirror/Js/Mode/Htmlmixed/htmlmixed.js"></script>
    
    
    
    
    <script>
        var editor = CodeMirror.fromTextArea(document.getElementById("demotext"), {
            lineNumbers: true,
            mode: "text/html",
            matchBrackets: true
        });
    </script>
    

    When I try to pack it up as a datatype I only get the raw Textarea

    .controller

    angular.module("umbraco").controller("CodeMirrorEditorController", function ($scope) {
    var editor = CodeMirror.fromTextArea(document.getElementById("codeTextBox"), {
        lineNumbers: true,
        mode: "text/html",
        matchBrackets: true
    });});
    

    .html

    <div ng-controller="CodeMirrorEditorController" class="guiInputStandardSize">
    <textarea id="codeTextBox" class="umb-editor umb-textarea textstring ng-scope" rows="30" ng-model="model.value"></textarea></div>
    

    .manifest

    {
    "propertyEditors": [
        {
            "name": "Codemirror",
            "alias": "Demo.Codemirror",
            "editor": {
                "view": "~/App_Plugins/CodeMirrorEditor/codemirroreditor.html"
            }
        }
    ],
    "css": [
        "~/umbraco_client/CodeMirror/js/lib/codemirror.css"
    ],
    "javascript": [
        "~/umbraco_client/CodeMirror/Js/Lib/codemirror.js",
        "~/umbraco_client/CodeMirror/Js/Mode/Xml/xml.js",
        "~/umbraco_client/CodeMirror/Js/Mode/Javascript/javascript.js",
        "~/umbraco_client/CodeMirror/Js/Mode/Css/css.js",
        "~/umbraco_client/CodeMirror/Js/Mode/Htmlmixed/htmlmixed.js",
        "~/App_Plugins/CodeMirrorEditor/codemirroreditor.controller.js"
    ]
    

    }

    I'm not very familiar with custom datatype creation - can any one spot what I'm doing wrong...? :-|

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Dec 07, 2016 @ 15:00
    Damiaan
    0

    Did you eventually succeed? Care sharing the result?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies