Naviga Writer
8.1.7
8.1.7
  • Naviga Writer
  • Release notes
    • 8.1.7
    • 8.1.6
    • 8.1.5
    • 8.1.4
    • 8.1.3
    • 8.1.2
    • 8.1.1
    • 8.1
    • 8.0
    • 7.2
    • 7.1.0
    • 7.0.0
    • 6.5.x
    • 6.5.0
    • 6.4.1
    • 6.4.0
    • 6.3.5
    • 6.3.4
    • 6.3.3
    • 6.3.2
    • 6.3.1
    • 6.2.2
    • 6.2.1
    • 6.2.0
    • 6.1.2
    • 6.1.1
    • 6.1.0
    • 6.0.0
    • 5.3.0
  • Introduction
    • Authoring
    • Developing
    • Publishing
    • History
  • User Guide
    • Writer User Guide
      • Create a new article
      • Top bar
        • Setting menu
        • Article name
        • Search and replace words
        • Version history of an article
          • List of versions
          • Changes in each version
          • Restore to an older version
        • Locked article
        • Active Users
        • Copy article url
        • Save and publish flow
        • History Button
      • Content area
        • Image gallery
        • Embed map
        • Table
        • Teaser
        • Content part
        • HTML embed
        • Upload image
        • Upload PDF
        • Textstyles
        • Lists
        • Special character
        • Marker tool
      • Right Sidebar
        • Meta
          • Author
          • Channels
        • Integrations
        • Image and Article search
      • Bottom bar
        • Article information
        • Edit metadata on linked images
        • Article size
        • Text information
        • Language menu
      • Images User Guide
        • Upload images
        • Metadata of the image
        • Cropping images
        • Download
      • Personal Writer Template
      • Writer Keyboard Shortcuts
      • Text Management
      • Common questions when starting using Writer
  • Admin Guide
    • Configuration Files
    • Configurations Guide
      • Right Sidebar
      • Text Information
      • Content menu
    • Article Templates Configuration
    • Byline configuration
    • Language Configuration
    • Publish Flow
      • Default configuration definitions
      • Publish flow config details
      • Preconditions for roles in the publish flow
    • Generic Properties
      • Configuration
    • Image Services
      • ImEngine
      • Imgix
    • Plugins
      • Naviga developed plugins
        • Plugins in earlier versions of Writer
      • Deprecated Plugins
      • Third-party plugins
  • Developer guide
    • Upgrade Guides
      • 8.0 - Image/PDF upload changes
      • 8.0 - Opening an Article
    • Writer Plugin Development
      • Quickstart
      • Type Definitions (beta)
      • Plugin overview
      • Creating a content object plugin
      • Validation and hooks
      • Interacting with external resources
    • Writer Plugin Building Blocks
      • Package
      • Component
      • Node
      • Converter
      • Events
    • Writer Plugin Style Guide
      • CSS Guidelines
      • CSS variables, colors and fonts
      • UI Components
    • Tutorials
      • Popover & text analysis
      • Search & replace
      • Concept interaction
      • Integrating External Spell Checking
    • Infomaker NewsML
      • Overview
      • Important: About inline notes
      • Document relations and types
      • Extensions XSD
      • NewsItem
      • ConceptItem
      • PlanningItem
      • Examples
        • NewsItem - Text
        • NewsItem - Picture
        • NewsItem - PDF
        • ConceptItem - Author
        • ConceptItem - Category
        • ConceptItem - Channel
        • ConceptItem - Content Profile
        • ConceptItem - Event
        • ConceptItem - Organisation
        • ConceptItem - Person
        • ConceptItem - Place (point)
        • ConceptItem - Place (polygon)
        • ConceptItem - Section
        • ConceptItem - Story
        • ConceptItem - Topic
        • PlanningItem
    • Media Enrichment
      • Images
  • API Reference
    • Writer Api
      • Api
      • Article
      • Browser
      • Concept
      • ConceptService
      • Document
      • Events
      • NewsItem
      • Router
      • Ui
      • Upload
      • User
      • settings
      • History
      • Settings
    • UI Components
      • UIAvatar
      • UIButton
      • UIByline
      • UICheckbox
      • UIChip
      • UIDatePicker
      • UIDatetimeFieldEditor
      • UIDropdown
      • UIFieldEditor
      • UIIconButton
      • UIInlineImage
      • UIPagination
      • UISelect
      • UITimePicker
      • UIToggle
      • UITooltip
      • UIInputText
      • UITextarea
      • UIButtonGroup
      • UIConceptSearch
      • UIDateTimePicker
      • UIInputSearch
      • UIIcon
      • UIPill
      • UISpinner
      • UIButtonList
      • UIIconBadge
      • UIIconButtonMenu
      • UIInputPassword
Powered by GitBook
On this page
  • Is my plugin affected?
  • Fixing creating BlockNodes with image and pdf types
  • Fixing api.editorSession.fileManager.sync
  • Fixing Nodes with custom image/pdf capabilities

Was this helpful?

  1. Developer guide
  2. Upgrade Guides

8.0 - Image/PDF upload changes

Naviga Writer 8.0 included breaking changes for plugins which create content object Nodes containing image or pdf files. Plugins with image drag-and-drop functionality for example could be affected.

Is my plugin affected?

Your plugin is affected if any of the following is true:

  • There is a Command or DropHandler in your plugin which creates BlockNodes with the types 'ximimage' or 'ximpdf'

  • There is a Command or DropHandler in your plugin which calls the function api.editorSession.fileManager.sync

  • Your plugin registers a Node with custom image/pdf upload capabilities

    • e.g. a custom image gallery, or other custom content object handling images

Fixing creating BlockNodes with image and pdf types

If there is no image/pdf created when your command/drophandler runs and you get an error similar to the following in the console:

Uncaught Error: Property fileNodeId is mandatory for node type ximimage

Find the place in your plugin where the method tx.insertBlockNode is called and replace the following property, depending on the node type:

ximimage Node

Replace imageFile: <your value> with fileNodeId: <your value>.

ximpdf Node

Replace pdfFile: <your value> with fileNodeId: <your value>.

Fixing api.editorSession.fileManager.sync

If the image/pdf node is created but it just seems to spin and never upload correctly, and the following error is printed in the console:

fileManager.sync is deprecated, please refer to the Naviga Writer 8.0 release overview for upgrade guide and fix

It is used mainly in commands/drophandlers which create FileNodes and BlockNodes with the type 'ximimage' or 'ximpdf'.

The sync method has been deprecated completely and will throw an error if called. To fix this, a new method called fileManager.upload has been created. This method takes an array of node Ids, and if the nodes created are image or pdf types, it should be as simple as replacing the function called:


// Creating nodes and storing the created node ids

setTimeout(() => {
    api.editorSession.fileManager.sync()
        .then(...)
        .catch(...)
}, 0)

// Replace the sync call above with the following call to upload

setTimeout(() => {
    api.editorSession.fileManager.upload([nodeId])
}, 0)

Fixing Nodes with custom image/pdf capabilities

Sometimes Nodes can store its own image/pdf data and in those cases the registered Node will need to be "uploadable". This can be accomplished by using the fileTrait imported from the writer module.

If your plugin is fairly new it should already be using at least the imageNodeTrait and imageCropTrait to add utility functions used by images.

Add the fileTrait as a parameter to withTraits function and rename the Node property defined as {type: 'file'} to fileNodeId.

When the fileManager.upload([nodeId]) function is called and the file upload completes/fails an event will be emitted on the Node. Add onFailedUpload and onUploaded functions to your Node class to handle the response.

Example below.

import {api, withTraits, traitBundle, BlockNode} from 'writer'

const {imageNodeTrait, imageCropTrait, authorNodeTrait, fileTrait} = traitBundle

class ExampleImageNode extends withTraits(BlockNode, imageNodeTrait, imageCropTrait, fileTrait) { 

    onFailedUpload({message, status, silent}) {
        // Do cleanup as needed
    }

    onUploaded(navigaDoc) {
        // Triggers after an image has finished uploading     
    }

}

ExampleImageNode.define({
    ...
    fileNodeId: {type: 'file'}
    ...
})

PreviousUpgrade GuidesNext8.0 - Opening an Article

Was this helpful?