Umbraco 7.9.2自定义属性编辑器无法正常工作求助
Hey there, let's get your custom Markdown property editor up and running in Umbraco 7.9.2. Based on what you've shared so far, here are the key checks and fixes to resolve the issue:
1. Finish and Validate Your package.manifest.json
Your manifest looks truncated, which is a common culprit. Umbraco requires a complete, valid JSON structure for property editors. Here's a full working example tailored to your setup:
{ "propertyEditors": [ { "alias": "My.MarkdownEditor", "name": "My markdown editor", "icon": "icon-code", "group": "Rich Content", "editor": { "view": "/App_Plugins/MarkDownEditor/markdowneditor.html" } } ], "javascript": [ "/App_Plugins/MarkDownEditor/markdowneditor.controller.js" ] }
- Make sure this file is placed directly inside your
~/App_Plugins/MarkDownEditor/folder (matches the folder name you created). - Run the JSON through a validator to fix any syntax errors (like unclosed brackets or incomplete comments).
2. Create the Required View File
You need a corresponding HTML view for your editor. Create markdowneditor.html in the same MarkDownEditor folder with this basic structure (you can expand it later for Markdown preview):
<div ng-controller="My.MarkdownEditorController"> <textarea ng-model="model.value" class="umb-editor umb-textarea" rows="10"></textarea> </div>
This binds the textarea to the property's value, which is the core functionality you need first.
3. Add the AngularJS Controller (If Using)
If your view references a controller (like in the example above), create markdowneditor.controller.js in the same folder with this code:
angular.module("umbraco") .controller("My.MarkdownEditorController", function ($scope) { // Initialize empty value to avoid undefined issues if (!$scope.model.value) { $scope.model.value = ""; } });
This ensures the editor behaves consistently when the property has no initial value.
4. Clear Umbraco and Browser Cache
Umbraco 7 caches manifest and plugin files aggressively. After making changes:
- Restart your web server (IIS, IIS Express, or your local dev server).
- Delete all files in
~/App_Data/TEMP/to clear Umbraco's internal cache. - Open the Umbraco backoffice in an incognito window (or clear your browser cache) to avoid cached assets.
5. Verify the Editor Appears in the Backoffice
Log into Umbraco, create or edit a document type, and try adding a new property. Look for "My markdown editor" in the "Rich Content" group. If it doesn't show up, double-check your manifest path and syntax.
6. Check Browser Console for Errors
Open your browser's developer tools (F12) and go to the Console tab. Look for:
- 404 errors: Indicates Umbraco can't find your view/JS files (check file paths and capitalization—Umbraco is case-sensitive on some servers).
- AngularJS errors: Means your controller isn't registered correctly or has syntax issues.
These errors will point you directly to the root cause if the above steps don't resolve the issue.
内容的提问来源于stack exchange,提问作者onTheInternet

